changeset 774:eb50336c8520

Merged multicoreware/xhevc into default
author Deepthi Devaki Akkoorath <deepthidevaki@multicorewareinc.com>
date Tue, 23 Apr 2013 11:07:40 +0530
parents 2996c71961a0 (current diff) 99deb04e11c5 (diff)
children 6daee65aa014
files source/Lib/encoder.cpp source/Lib/encoder.h source/Lib/libmd5/MD5.h source/Lib/libmd5/libmd5.c source/Lib/libmd5/libmd5.h source/encoder/vec/macroblock.inc
diffstat 142 files changed, 9349 insertions(+-), 10097 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Apr 23 11:06:42 2013 +0530
+++ b/.hgignore	Tue Apr 23 11:07:40 2013 +0530
@@ -2,3 +2,5 @@ syntax: glob
 build/
 **.rej
 **.orig
+**.hevc
+**.yuv
--- a/cfg/encoder_I_15P.cfg	Tue Apr 23 11:06:42 2013 +0530
+++ b/cfg/encoder_I_15P.cfg	Tue Apr 23 11:07:40 2013 +0530
@@ -22,7 +22,6 @@ Frame1:  P    1   3        0.4624   0   
 Frame2:  P    2   2        0.4624   0            0               0           1                1         -1    			    1      -1       2         0 1 
 Frame3:  P    3   3        0.4624   0            0               0           1                1         -1        		    1      -1       2         0 1           
 Frame4:  P    4   1        0.578    0            0               0           1                1         -1        		    1      -1       2         0 1 
-ListCombination               : 1           # Use combined list for uni-prediction in B-slices
 
 #=========== Motion Search =============
 FastSearch                    : 1           # 0:Full search  1:TZ search
@@ -93,8 +92,7 @@ WaveFrontSynchro                    : 0 
                                                        # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
 
 #=========== Quantization Matrix =================
-ScalingList                   : 0                      # ScalingList 0 : off, 1 : default, 2 : file read
-ScalingListFile               : scaling_list.txt       # Scaling List file name. If file is not exist, use Default Matrix.
+ScalingList                   : 0                      # ScalingList 0 : off, 1 : default
 
 #============ Lossless ================
 TransquantBypassEnableFlag: 0  # Value of PPS flag.
--- a/cfg/encoder_all_I.cfg	Tue Apr 23 11:06:42 2013 +0530
+++ b/cfg/encoder_all_I.cfg	Tue Apr 23 11:07:40 2013 +0530
@@ -87,8 +87,7 @@ WaveFrontSynchro                    : 0 
                                                        # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
 
 #=========== Quantization Matrix =================
-ScalingList                   : 0                      # ScalingList 0 : off, 1 : default, 2 : file read
-ScalingListFile               : scaling_list.txt       # Scaling List file name. If file is not exist, use Default Matrix.
+ScalingList                   : 0                      # ScalingList 0 : off, 1 : default
 
 #============ Lossless ================
 TransquantBypassEnableFlag: 0  # Value of PPS flag.
--- a/doc/uncrustify/apply-to-all-source.py	Tue Apr 23 11:06:42 2013 +0530
+++ b/doc/uncrustify/apply-to-all-source.py	Tue Apr 23 11:07:40 2013 +0530
@@ -5,7 +5,7 @@ import subprocess
 import shutil
 
 EXTENSIONS = ['.h', '.cpp', '.inc', '.c']
-EXCLUDES = ['VectorClass']
+EXCLUDES = ['VectorClass', 'compat', 'x86']
 
 candidates = []
 for (dirpath, dirnames, filenames) in os.walk('../../source'):
--- a/doc/uncrustify/codingstyle.cfg	Tue Apr 23 11:06:42 2013 +0530
+++ b/doc/uncrustify/codingstyle.cfg	Tue Apr 23 11:07:40 2013 +0530
@@ -1,4 +1,3 @@
-#align_same_func_call_params=true
 align_func_params=true
 align_keep_tabs=false
 align_left_shift=true
@@ -25,13 +24,11 @@ cmt_cpp_to_c=false
 cmt_indent_multi=false
 cmt_insert_before_preproc=false
 cmt_multi_check_last=true
-# do not want to munge HM comments, which can be very far to the right
-# optimally, we would use 2 here for our own new code
 cmt_reflow_mode=1
 cmt_sp_before_star_cont=0
 cmt_star_cont=true
 cmt_width=130
-code_width=130
+#code_width=130
 eat_blanks_after_open_brace=true
 eat_blanks_before_close_brace=true
 indent_access_spec_body=false
@@ -87,15 +84,15 @@ mod_sort_include=false
 mod_sort_using=false
 newlines=lf
 nl_after_access_spec=2
-nl_after_brace_close=false
-nl_after_brace_open=true
+nl_after_brace_close=ignore
+nl_after_brace_open=ignore
 nl_after_brace_open_cmt=true
 nl_after_case=false
 nl_after_class=2
 nl_after_for=add
 nl_after_func_body=2
 nl_after_func_body_one_liner=2
-nl_after_if=add
+nl_after_if=ignore
 nl_after_multiline_comment=true
 nl_after_return=false
 nl_after_semicolon=true
@@ -171,7 +168,6 @@ sp_after_dc=remove
 sp_after_new=add
 sp_after_operator=add
 sp_after_operator_sym=remove
-sp_after_semi=remove
 sp_after_type=ignore
 sp_angle_paren=remove
 sp_angle_word=add
@@ -191,9 +187,10 @@ sp_before_semi_for=remove
 sp_before_semi_for_empty=remove
 sp_before_sparen=add
 sp_before_square=remove
-sp_before_squares=remove
+sp_before_squares=ignore
 sp_before_tr_emb_cmt=add
 sp_bool=add
+sp_brace_else=add
 sp_cmt_cpp_start=ignore
 sp_compare=add
 sp_cond_colon=add
@@ -201,6 +198,7 @@ sp_cond_question=add
 sp_cpp_cast_paren=remove
 sp_defined_paren=remove
 sp_deref=remove
+sp_else_brace=add
 sp_endif_cmt=add
 sp_enum_assign=add
 sp_fparen_brace=add
@@ -226,7 +224,7 @@ sp_paren_paren=remove
 sp_pp_concat=add
 sp_sign=remove
 sp_sizeof_paren=remove
-sp_special_semi=remove
+sp_special_semi=ignore
 sp_template_angle=remove
 tok_split_gte=false
 utf8_bom=remove
Binary file doc/uncrustify/uncrustify.exe has changed
--- a/source/CMakeLists.txt	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/CMakeLists.txt	Tue Apr 23 11:07:40 2013 +0530
@@ -19,6 +19,7 @@ endif()
 if(MSVC)
     add_definitions(/W4 /WX /D_CRT_SECURE_NO_WARNINGS)
     add_definitions(/Ob2) # always inline
+    add_definitions(/Oi)  # enable intrinsics
     include_directories(compat/msvc)
     # Add some multithreaded build support
     option(MULTITHREADED_BUILD "Number of threads to use for build" ON)
@@ -81,10 +82,14 @@ if(ENABLE_CLI)
         add_definitions(-Wno-sign-compare)
         add_definitions(-Wno-unused-parameter)
     endif(GCC)
+    set_source_files_properties(x265cfg.cpp  PROPERTIES COMPILE_FLAGS -D_CRT_NONSTDC_NO_DEPRECATE)
     set_source_files_properties(x265main.cpp PROPERTIES COMPILE_FLAGS -DX265_VERSION=${X265_VERSION})
 
     add_subdirectory(input)
-    add_executable(x265-cli x265main.cpp x265cfg.cpp x265cfg.h ${EXTRAS})
+    add_executable(x265-cli
+        x265main.cpp ${EXTRAS}
+        x265cfg.cpp x265cfg.h
+        x265enc.cpp x265enc.h)
 
     target_link_libraries(x265-cli HM x265 InputFiles)
     if(ENABLE_PPA)
--- a/source/Lib/CMakeLists.txt	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/CMakeLists.txt	Tue Apr 23 11:07:40 2013 +0530
@@ -17,13 +17,10 @@ file(GLOB APPCOMMON  TAppCommon/*.h TApp
 file(GLOB LIBCOMMON  TLibCommon/*.h TLibCommon/*.cpp)
 file(GLOB LIBENCODER TLibEncoder/*.h TLibEncoder/*.cpp)
 file(GLOB LIBVIDEOIO TLibVideoIO/*.h TLibVideoIO/*.cpp)
-file(GLOB MD5        libmd5/*.h libmd5/*.c)
 
-source_group(md5         FILES ${MD5})
 source_group(TLibVideoIO FILES ${LIBVIDEOIO})
 source_group(TAppCommon  FILES ${APPCOMMON})
 source_group(TLibCommon  FILES ${LIBCOMMON})
 source_group(TLibEncoder FILES ${LIBENCODER})
 
-add_library(HM ${LIBCOMMON} ${LIBENCODER} ${APPCOMMON} ${LIBVIDEOIO} ${MD5}
-            encoder.cpp encoder.h)
+add_library(HM ${LIBCOMMON} ${LIBENCODER} ${APPCOMMON} ${LIBVIDEOIO})
--- a/source/Lib/TAppCommon/program_options_lite.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TAppCommon/program_options_lite.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -71,7 +71,6 @@ void Options::addOption(OptionBase *opt)
             opt_start++;
             force_short = 1;
         }
-
         string opt_name = opt_string.substr(opt_start, opt_end - opt_start);
         if (force_short || opt_name.size() == 1)
         {
@@ -83,7 +82,6 @@ void Options::addOption(OptionBase *opt)
             names->opt_long.push_back(opt_name);
             opt_long_map[opt_name].push_back(names);
         }
-
         opt_start += opt_end + 1;
     }
 
@@ -124,7 +122,6 @@ static void doHelpOpt(ostream& out, cons
         {
             out << ", ";
         }
-
         out << &(spaces[40 - pad]);
     }
     else
@@ -174,7 +171,6 @@ void doHelp(ostream& out, Options& opts,
             cout << line.str() << endl;
             continue;
         }
-
         size_t currlength = size_t(line.tellp());
         if (currlength > opt_width)
         {
@@ -199,14 +195,12 @@ void doHelp(ostream& out, Options& opts,
                 cur_pos = newline_pos;
                 continue;
             }
-
             if (cur_pos + desc_width > opt_desc.size())
             {
                 /* no need to wrap text, remainder is less than avaliable width */
                 line << opt_desc.substr(cur_pos);
                 break;
             }
-
             /* find a suitable point to split text (avoid spliting in middle of word) */
             size_t split_pos = opt_desc.find_last_of(' ', cur_pos + desc_width);
             if (split_pos != string::npos)
@@ -221,7 +215,6 @@ void doHelp(ostream& out, Options& opts,
             {
                 split_pos = cur_pos + desc_width;
             }
-
             line << opt_desc.substr(cur_pos, split_pos - cur_pos);
 
             /* eat up any space for the start of the next line */
@@ -229,14 +222,12 @@ void doHelp(ostream& out, Options& opts,
             {
                 split_pos = opt_desc.find_first_not_of(' ', split_pos);
             }
-
             cur_pos = newline_pos = split_pos;
 
             if (cur_pos >= opt_desc.size())
             {
                 break;
             }
-
             line << endl;
         }
 
@@ -312,7 +303,6 @@ unsigned parseGNU(Options& opts, unsigne
         * booleans */
         if (argc == 1)
             return 0; /* run out of argv for argument */
-
         extra_argc_consumed = 1;
 #endif
         if (!storePair(opts, true, false, option, "1"))
@@ -350,13 +340,13 @@ unsigned parseSHORT(Options& opts, unsig
         cerr << "Not processing option without argument `" << option << "'" << endl;
         return 0; /* run out of argv for argument */
     }
-
     storePair(opts, false, true, option, string(argv[1]));
 
     return 1;
 }
 
-list<const char*> scanArgv(Options& opts, unsigned argc, const char* argv[])
+list<const char*>
+scanArgv(Options& opts, unsigned argc, const char* argv[])
 {
     /* a list for anything that didn't get handled as an option */
     list<const char*> non_option_arguments;
@@ -415,13 +405,11 @@ void scanLine(Options& opts, string& lin
         /* blank line */
         return;
     }
-
     if (line[start] == '#')
     {
         /* comment line */
         return;
     }
-
     /* look for first whitespace or ':' after the option end */
     size_t option_end = line.find_first_of(": \t\n\r", start);
     string option = line.substr(start, option_end - start);
@@ -433,7 +421,6 @@ void scanLine(Options& opts, string& lin
         /* error: badly formatted line */
         return;
     }
-
     if (line[start] != ':')
     {
         /* error: badly formatted line */
@@ -459,7 +446,6 @@ void scanLine(Options& opts, string& lin
             value_end--;
             break;
         }
-
         value_end = line.find_first_of(" \t\n\r", value_end);
 
         /* consume any white space, incase there is another word.
@@ -515,10 +501,9 @@ void parseConfigFile(Options& opts, cons
         cerr << "Failed to open config file: `" << filename << "'" << endl;
         exit(EXIT_FAILURE);
     }
-
     scanFile(opts, cfgstream);
 }
-};
-};
+}
+}
 
 //! \}
--- a/source/Lib/TAppCommon/program_options_lite.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TAppCommon/program_options_lite.h	Tue Apr 23 11:07:40 2013 +0530
@@ -52,10 +52,9 @@ struct ParseFailure : public std::except
     ~ParseFailure() throw() {}
 
     std::string arg;
-
     std::string val;
 
-    const char* what() const throw() { return "Option Parse Failure";}
+    const char* what() const throw() { return "Option Parse Failure"; }
 };
 
 void doHelp(std::ostream& out, Options& opts, unsigned columns = 80);
@@ -224,7 +223,7 @@ private:
 
     Options& parent;
 };
-};   /* namespace: program_options_lite */
-}; /* namespace: df */
+}    /* namespace: program_options_lite */
+}  /* namespace: df */
 
 //! \}
--- a/source/Lib/TLibCommon/CommonDef.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h	Tue Apr 23 11:07:40 2013 +0530
@@ -109,7 +109,9 @@
 
 #define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
 #define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
+#if !L0034_COMBINED_LIST_CLEANUP
 #define MAX_NUM_REF_LC              MAX_NUM_REF_PICS  // TODO: remove this macro definition (leftover from combined list concept)
+#endif
 
 #define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
 #define MAX_INT                     2147483647  ///< max. value of signed 32-bit integer
@@ -129,14 +131,14 @@ extern Int g_bitDepthC;
 
 /** clip x, such that 0 <= x <= #g_maxLumaVal */
 template<typename T>
-inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY) - 1), std::max<T>(T(0), x));}
+inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY) - 1), std::max<T>(T(0), x)); }
 
 template<typename T>
-inline T ClipC(T x) { return std::min<T>(T((1 << g_bitDepthC) - 1), std::max<T>(T(0), x));}
+inline T ClipC(T x) { return std::min<T>(T((1 << g_bitDepthC) - 1), std::max<T>(T(0), x)); }
 
 /** clip a, such that minVal <= a <= maxVal */
 template<typename T>
-inline T Clip3(T minVal, T maxVal, T a) { return std::min<T>(std::max<T>(minVal, a), maxVal);}                             ///< general min/max clip
+inline T Clip3(T minVal, T maxVal, T a) { return std::min<T>(std::max<T>(minVal, a), maxVal); }                            ///< general min/max clip
 
 #define DATA_ALIGN                  1                                                                 ///< use 32-bit aligned malloc/free
 #if     DATA_ALIGN && _WIN32 && (_MSC_VER > 1300)
--- a/source/Lib/TLibCommon/ContextModel.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/ContextModel.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -108,39 +108,23 @@ const Int ContextModel::m_entropyBits[12
 {
 #if FAST_BIT_EST
     // Corrected table, most notably for last state
-    0x07b23, 0x085f9, 0x074a0, 0x08cbc, 0x06ee4, 0x09354, 0x067f4, 0x09c1b, 0x060b0, 0x0a62a, 0x05a9c, 0x0af5b, 0x0548d, 0x0b955,
-    0x04f56, 0x0c2a9,
-    0x04a87, 0x0cbf7, 0x045d6, 0x0d5c3, 0x04144, 0x0e01b, 0x03d88, 0x0e937, 0x039e0, 0x0f2cd, 0x03663, 0x0fc9e, 0x03347, 0x10600,
-    0x03050, 0x10f95,
-    0x02d4d, 0x11a02, 0x02ad3, 0x12333, 0x0286e, 0x12cad, 0x02604, 0x136df, 0x02425, 0x13f48, 0x021f4, 0x149c4, 0x0203e, 0x1527b,
-    0x01e4d, 0x15d00,
-    0x01c99, 0x166de, 0x01b18, 0x17017, 0x019a5, 0x17988, 0x01841, 0x18327, 0x016df, 0x18d50, 0x015d9, 0x19547, 0x0147c, 0x1a083,
-    0x0138e, 0x1a8a3,
-    0x01251, 0x1b418, 0x01166, 0x1bd27, 0x01068, 0x1c77b, 0x00f7f, 0x1d18e, 0x00eda, 0x1d91a, 0x00e19, 0x1e254, 0x00d4f, 0x1ec9a,
-    0x00c90, 0x1f6e0,
-    0x00c01, 0x1fef8, 0x00b5f, 0x208b1, 0x00ab6, 0x21362, 0x00a15, 0x21e46, 0x00988, 0x2285d, 0x00934, 0x22ea8, 0x008a8, 0x239b2,
-    0x0081d, 0x24577,
-    0x007c9, 0x24ce6, 0x00763, 0x25663, 0x00710, 0x25e8f, 0x006a0, 0x26a26, 0x00672, 0x26f23, 0x005e8, 0x27ef8, 0x005ba, 0x284b5,
-    0x0055e, 0x29057,
-    0x0050c, 0x29bab, 0x004c1, 0x2a674, 0x004a7, 0x2aa5e, 0x0046f, 0x2b32f, 0x0041f, 0x2c0ad, 0x003e7, 0x2ca8d, 0x003ba, 0x2d323,
-    0x0010c, 0x3bfbb
-#else // if FAST_BIT_EST
-    0x08000, 0x08000, 0x076da, 0x089a0, 0x06e92, 0x09340, 0x0670a, 0x09cdf, 0x06029, 0x0a67f, 0x059dd, 0x0b01f, 0x05413, 0x0b9bf,
-    0x04ebf, 0x0c35f,
-    0x049d3, 0x0ccff, 0x04546, 0x0d69e, 0x0410d, 0x0e03e, 0x03d22, 0x0e9de, 0x0397d, 0x0f37e, 0x03619, 0x0fd1e, 0x032ee, 0x106be,
-    0x02ffa, 0x1105d,
-    0x02d37, 0x119fd, 0x02aa2, 0x1239d, 0x02836, 0x12d3d, 0x025f2, 0x136dd, 0x023d1, 0x1407c, 0x021d2, 0x14a1c, 0x01ff2, 0x153bc,
-    0x01e2f, 0x15d5c,
-    0x01c87, 0x166fc, 0x01af7, 0x1709b, 0x0197f, 0x17a3b, 0x0181d, 0x183db, 0x016d0, 0x18d7b, 0x01595, 0x1971b, 0x0146c, 0x1a0bb,
-    0x01354, 0x1aa5a,
-    0x0124c, 0x1b3fa, 0x01153, 0x1bd9a, 0x01067, 0x1c73a, 0x00f89, 0x1d0da, 0x00eb7, 0x1da79, 0x00df0, 0x1e419, 0x00d34, 0x1edb9,
-    0x00c82, 0x1f759,
-    0x00bda, 0x200f9, 0x00b3c, 0x20a99, 0x00aa5, 0x21438, 0x00a17, 0x21dd8, 0x00990, 0x22778, 0x00911, 0x23118, 0x00898, 0x23ab8,
-    0x00826, 0x24458,
-    0x007ba, 0x24df7, 0x00753, 0x25797, 0x006f2, 0x26137, 0x00696, 0x26ad7, 0x0063f, 0x27477, 0x005ed, 0x27e17, 0x0059f, 0x287b6,
-    0x00554, 0x29156,
-    0x0050e, 0x29af6, 0x004cc, 0x2a497, 0x0048d, 0x2ae35, 0x00451, 0x2b7d6, 0x00418, 0x2c176, 0x003e2, 0x2cb15, 0x003af, 0x2d4b5,
-    0x0037f, 0x2de55
+    0x07b23, 0x085f9, 0x074a0, 0x08cbc, 0x06ee4, 0x09354, 0x067f4, 0x09c1b, 0x060b0, 0x0a62a, 0x05a9c, 0x0af5b, 0x0548d, 0x0b955, 0x04f56, 0x0c2a9,
+    0x04a87, 0x0cbf7, 0x045d6, 0x0d5c3, 0x04144, 0x0e01b, 0x03d88, 0x0e937, 0x039e0, 0x0f2cd, 0x03663, 0x0fc9e, 0x03347, 0x10600, 0x03050, 0x10f95,
+    0x02d4d, 0x11a02, 0x02ad3, 0x12333, 0x0286e, 0x12cad, 0x02604, 0x136df, 0x02425, 0x13f48, 0x021f4, 0x149c4, 0x0203e, 0x1527b, 0x01e4d, 0x15d00,
+    0x01c99, 0x166de, 0x01b18, 0x17017, 0x019a5, 0x17988, 0x01841, 0x18327, 0x016df, 0x18d50, 0x015d9, 0x19547, 0x0147c, 0x1a083, 0x0138e, 0x1a8a3,
+    0x01251, 0x1b418, 0x01166, 0x1bd27, 0x01068, 0x1c77b, 0x00f7f, 0x1d18e, 0x00eda, 0x1d91a, 0x00e19, 0x1e254, 0x00d4f, 0x1ec9a, 0x00c90, 0x1f6e0,
+    0x00c01, 0x1fef8, 0x00b5f, 0x208b1, 0x00ab6, 0x21362, 0x00a15, 0x21e46, 0x00988, 0x2285d, 0x00934, 0x22ea8, 0x008a8, 0x239b2, 0x0081d, 0x24577,
+    0x007c9, 0x24ce6, 0x00763, 0x25663, 0x00710, 0x25e8f, 0x006a0, 0x26a26, 0x00672, 0x26f23, 0x005e8, 0x27ef8, 0x005ba, 0x284b5, 0x0055e, 0x29057,
+    0x0050c, 0x29bab, 0x004c1, 0x2a674, 0x004a7, 0x2aa5e, 0x0046f, 0x2b32f, 0x0041f, 0x2c0ad, 0x003e7, 0x2ca8d, 0x003ba, 0x2d323, 0x0010c, 0x3bfbb
+#else
+    0x08000, 0x08000, 0x076da, 0x089a0, 0x06e92, 0x09340, 0x0670a, 0x09cdf, 0x06029, 0x0a67f, 0x059dd, 0x0b01f, 0x05413, 0x0b9bf, 0x04ebf, 0x0c35f,
+    0x049d3, 0x0ccff, 0x04546, 0x0d69e, 0x0410d, 0x0e03e, 0x03d22, 0x0e9de, 0x0397d, 0x0f37e, 0x03619, 0x0fd1e, 0x032ee, 0x106be, 0x02ffa, 0x1105d,
+    0x02d37, 0x119fd, 0x02aa2, 0x1239d, 0x02836, 0x12d3d, 0x025f2, 0x136dd, 0x023d1, 0x1407c, 0x021d2, 0x14a1c, 0x01ff2, 0x153bc, 0x01e2f, 0x15d5c,
+    0x01c87, 0x166fc, 0x01af7, 0x1709b, 0x0197f, 0x17a3b, 0x0181d, 0x183db, 0x016d0, 0x18d7b, 0x01595, 0x1971b, 0x0146c, 0x1a0bb, 0x01354, 0x1aa5a,
+    0x0124c, 0x1b3fa, 0x01153, 0x1bd9a, 0x01067, 0x1c73a, 0x00f89, 0x1d0da, 0x00eb7, 0x1da79, 0x00df0, 0x1e419, 0x00d34, 0x1edb9, 0x00c82, 0x1f759,
+    0x00bda, 0x200f9, 0x00b3c, 0x20a99, 0x00aa5, 0x21438, 0x00a17, 0x21dd8, 0x00990, 0x22778, 0x00911, 0x23118, 0x00898, 0x23ab8, 0x00826, 0x24458,
+    0x007ba, 0x24df7, 0x00753, 0x25797, 0x006f2, 0x26137, 0x00696, 0x26ad7, 0x0063f, 0x27477, 0x005ed, 0x27e17, 0x0059f, 0x287b6, 0x00554, 0x29156,
+    0x0050e, 0x29af6, 0x004cc, 0x2a497, 0x0048d, 0x2ae35, 0x00451, 0x2b7d6, 0x00418, 0x2c176, 0x003e2, 0x2cb15, 0x003af, 0x2d4b5, 0x0037f, 0x2de55
 #endif // if FAST_BIT_EST
 };
 //! \}
--- a/source/Lib/TLibCommon/ContextModel.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/ContextModel.h	Tue Apr 23 11:07:40 2013 +0530
@@ -56,17 +56,17 @@ class ContextModel
 {
 public:
 
-    ContextModel()                        { m_ucState = 0;m_binsCoded = 0;}
+    ContextModel()                        { m_ucState = 0; m_binsCoded = 0; }
 
     ~ContextModel()                        {}
 
-    UChar getState()                { return m_ucState >> 1;}                         ///< get current state
+    UChar getState()                { return m_ucState >> 1;  }                       ///< get current state
 
-    UChar getMps()                { return m_ucState  & 1;}                           ///< get curret MPS
+    UChar getMps()                { return m_ucState  & 1;  }                         ///< get curret MPS
 
-    Void  setStateAndMps(UChar ucState, UChar ucMPS) { m_ucState = (ucState << 1) + ucMPS;} ///< set state and MPS
+    Void  setStateAndMps(UChar ucState, UChar ucMPS) { m_ucState = (ucState << 1) + ucMPS; } ///< set state and MPS
 
-    Void init(Int qp, Int initValue);    ///< initialize state with initial probability
+    Void init(Int qp, Int initValue);   ///< initialize state with initial probability
 
     Void updateLPS()
     {
@@ -78,7 +78,7 @@ public:
         m_ucState = m_aucNextStateMPS[m_ucState];
     }
 
-    Int getEntropyBits(Short val) { return m_entropyBits[m_ucState ^ val];}
+    Int getEntropyBits(Short val) { return m_entropyBits[m_ucState ^ val]; }
 
 #if FAST_BIT_EST
     Void update(Int binVal)
@@ -87,12 +87,12 @@ public:
     }
 
     static Void buildNextStateTable();
-    static Int getEntropyBitsTrm(Int val) { return m_entropyBits[126 ^ val];}
+    static Int getEntropyBitsTrm(Int val) { return m_entropyBits[126 ^ val]; }
 
 #endif
-    Void setBinsCoded(UInt val)   { m_binsCoded = val;}
+    Void setBinsCoded(UInt val)   { m_binsCoded = val;  }
 
-    UInt getBinsCoded()           { return m_binsCoded;}
+    UInt getBinsCoded()           { return m_binsCoded;   }
 
 private:
 
--- a/source/Lib/TLibCommon/ContextModel3DBuffer.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/ContextModel3DBuffer.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -95,22 +95,7 @@ UInt ContextModel3DBuffer::calcCost(Slic
         tmpContextModel.init(qp, ctxModel[n]);
 
         // Map the 64 CABAC states to their corresponding probability values
-        static Double aStateToProbLPS[] =
-        {
-            0.50000000, 0.47460857, 0.45050660, 0.42762859, 0.40591239,
-            0.38529900, 0.36573242, 0.34715948, 0.32952974, 0.31279528,
-            0.29691064, 0.28183267, 0.26752040, 0.25393496, 0.24103941,
-            0.22879875, 0.21717969, 0.20615069, 0.19568177, 0.18574449,
-            0.17631186, 0.16735824, 0.15885931, 0.15079198, 0.14313433,
-            0.13586556, 0.12896592, 0.12241667, 0.11620000, 0.11029903,
-            0.10469773, 0.09938088, 0.09433404, 0.08954349, 0.08499621,
-            0.08067986, 0.07658271, 0.07269362, 0.06900203, 0.06549791,
-            0.06217174, 0.05901448, 0.05601756, 0.05317283, 0.05047256,
-            0.04790942, 0.04547644, 0.04316702, 0.04097487, 0.03889405,
-            0.03691890, 0.03504406, 0.03326442, 0.03157516, 0.02997168,
-            0.02844963, 0.02700488, 0.02563349, 0.02433175, 0.02309612,
-            0.02192323, 0.02080991, 0.01975312, 0.01875000
-        };
+        static Double aStateToProbLPS[] = { 0.50000000, 0.47460857, 0.45050660, 0.42762859, 0.40591239, 0.38529900, 0.36573242, 0.34715948, 0.32952974, 0.31279528, 0.29691064, 0.28183267, 0.26752040, 0.25393496, 0.24103941, 0.22879875, 0.21717969, 0.20615069, 0.19568177, 0.18574449, 0.17631186, 0.16735824, 0.15885931, 0.15079198, 0.14313433, 0.13586556, 0.12896592, 0.12241667, 0.11620000, 0.11029903, 0.10469773, 0.09938088, 0.09433404, 0.08954349, 0.08499621, 0.08067986, 0.07658271, 0.07269362, 0.06900203, 0.06549791, 0.06217174, 0.05901448, 0.05601756, 0.05317283, 0.05047256, 0.04790942, 0.04547644, 0.04316702, 0.04097487, 0.03889405, 0.03691890, 0.03504406, 0.03326442, 0.03157516, 0.02997168, 0.02844963, 0.02700488, 0.02563349, 0.02433175, 0.02309612, 0.02192323, 0.02080991, 0.01975312, 0.01875000 };
 
         Double probLPS          = aStateToProbLPS[m_contextModel[n].getState()];
         Double prob0, prob1;
--- a/source/Lib/TLibCommon/ContextModel3DBuffer.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/ContextModel3DBuffer.h	Tue Apr 23 11:07:40 2013 +0530
@@ -62,8 +62,6 @@ protected:
     const UInt    m_sizeXY;     ///< X times Y size of 3D buffer
     const UInt    m_sizeXYZ;    ///< total size of 3D buffer
 
-    ContextModel3DBuffer operator =(const ContextModel3DBuffer&);
-
 public:
 
     ContextModel3DBuffer(UInt uiSizeZ, UInt uiSizeY, UInt uiSizeX, ContextModel *basePtr, Int &count);
--- a/source/Lib/TLibCommon/ContextTables.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/ContextTables.h	Tue Apr 23 11:07:40 2013 +0530
@@ -255,26 +255,17 @@ static const UChar
 static const UChar
     INIT_SIG_FLAG[3][NUM_SIG_FLAG_CTX] =
 {
-    { 170,  154,  139,  153,  139,  123,  123,   63,  124,  166,  183,  140,  136,  153,  154,  166,  183,  140,  136,  153,  154,
-      166,  183,  140,  136,  153,  154,  170,  153,  138,  138,  122,  121,  122,  121,  167,  151,  183,  140,  151,  183,
-      140,  },
-    { 155,  154,  139,  153,  139,  123,  123,   63,  153,  166,  183,  140,  136,  153,  154,  166,  183,  140,  136,  153,  154,
-      166,  183,  140,  136,  153,  154,  170,  153,  123,  123,  107,  121,  107,  121,  167,  151,  183,  140,  151,  183,
-      140,  },
-    { 111,  111,  125,  110,  110,   94,  124,  108,  124,  107,  125,  141,  179,  153,  125,  107,  125,  141,  179,  153,  125,
-      107,  125,  141,  179,  153,  125,  140,  139,  182,  182,  152,  136,  152,  136,  153,  136,  139,  111,  136,  139,
-      111,  },
+    { 170,  154,  139,  153,  139,  123,  123,   63,  124,  166,  183,  140,  136,  153,  154,  166,  183,  140,  136,  153,  154,  166,  183,  140,  136,  153,  154,  170,  153,  138,  138,  122,  121,  122,  121,  167,  151,  183,  140,  151,  183,  140,  },
+    { 155,  154,  139,  153,  139,  123,  123,   63,  153,  166,  183,  140,  136,  153,  154,  166,  183,  140,  136,  153,  154,  166,  183,  140,  136,  153,  154,  170,  153,  123,  123,  107,  121,  107,  121,  167,  151,  183,  140,  151,  183,  140,  },
+    { 111,  111,  125,  110,  110,   94,  124,  108,  124,  107,  125,  141,  179,  153,  125,  107,  125,  141,  179,  153,  125,  107,  125,  141,  179,  153,  125,  140,  139,  182,  182,  152,  136,  152,  136,  153,  136,  139,  111,  136,  139,  111,  },
 };
 
 static const UChar
     INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
 {
-    { 154,  196,  167,  167,  154,  152,  167,  182,  182,  134,  149,  136,  153,  121,  136,  122,  169,  208,  166,  167,  154,
-      152,  167,  182, },
-    { 154,  196,  196,  167,  154,  152,  167,  182,  182,  134,  149,  136,  153,  121,  136,  137,  169,  194,  166,  167,  154,
-      167,  137,  182, },
-    { 140,   92,  137,  138,  140,  152,  138,  139,  153,   74,  149,   92,  139,  107,  122,  152,  140,  179,  166,  182,  140,
-      227,  122,  197, },
+    { 154,  196,  167,  167,  154,  152,  167,  182,  182,  134,  149,  136,  153,  121,  136,  122,  169,  208,  166,  167,  154,  152,  167,  182, },
+    { 154,  196,  196,  167,  154,  152,  167,  182,  182,  134,  149,  136,  153,  121,  136,  137,  169,  194,  166,  167,  154,  167,  137,  182, },
+    { 140,   92,  137,  138,  140,  152,  138,  139,  153,   74,  149,   92,  139,  107,  122,  152,  140,  179,  166,  182,  140,  227,  122,  197, },
 };
 
 static const UChar
--- a/source/Lib/TLibCommon/SEI.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/SEI.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -40,13 +40,7 @@
 
 #if J0149_TONE_MAPPING_SEI
 //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator
-Int  Table_exp_indicator[32] =
-{
-    0, 10, 12, 16, 20, 25, 32, 40, 50, 64,
-    80, 100, 125, 160, 200, 250, 320, 400,
-    500, 640, 800, 1000, 1250, 1600, 2000,
-    2500, 3200, 4000, 5000, 6400, 8000, -1
-};
+Int  Table_exp_indicator[32] = { 0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1 };
 #endif
 
 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
--- a/source/Lib/TLibCommon/SEI.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/SEI.h	Tue Apr 23 11:07:40 2013 +0530
@@ -85,7 +85,7 @@ class SEIuserDataUnregistered : public S
 {
 public:
 
-    PayloadType payloadType() const { return USER_DATA_UNREGISTERED;}
+    PayloadType payloadType() const { return USER_DATA_UNREGISTERED; }
 
     SEIuserDataUnregistered()
         : userData(0)
@@ -105,7 +105,7 @@ class SEIDecodedPictureHash : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return DECODED_PICTURE_HASH;}
+    PayloadType payloadType() const { return DECODED_PICTURE_HASH; }
 
     SEIDecodedPictureHash() {}
 
@@ -126,7 +126,7 @@ class SEIActiveParameterSets : public SE
 {
 public:
 
-    PayloadType payloadType() const { return ACTIVE_PARAMETER_SETS;}
+    PayloadType payloadType() const { return ACTIVE_PARAMETER_SETS; }
 
     SEIActiveParameterSets()
 #if !L0047_APS_FLAGS
@@ -154,7 +154,7 @@ class SEIBufferingPeriod : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return BUFFERING_PERIOD;}
+    PayloadType payloadType() const { return BUFFERING_PERIOD; }
 
     SEIBufferingPeriod()
 #if L0044_CPB_DPB_DELAY_OFFSET
@@ -194,7 +194,7 @@ class SEIPictureTiming : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return PICTURE_TIMING;}
+    PayloadType payloadType() const { return PICTURE_TIMING; }
 
     SEIPictureTiming()
         : m_picStruct(0)
@@ -217,7 +217,6 @@ public:
         {
             delete m_numNalusInDuMinus1;
         }
-
         if (m_duCpbRemovalDelayMinus1  != NULL)
         {
             delete m_duCpbRemovalDelayMinus1;
@@ -248,7 +247,7 @@ class SEIDecodingUnitInfo : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return DECODING_UNIT_INFO;}
+    PayloadType payloadType() const { return DECODING_UNIT_INFO; }
 
     SEIDecodingUnitInfo()
         : m_decodingUnitIdx(0)
@@ -273,7 +272,7 @@ class SEIRecoveryPoint : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return RECOVERY_POINT;}
+    PayloadType payloadType() const { return RECOVERY_POINT; }
 
     SEIRecoveryPoint() {}
 
@@ -288,7 +287,7 @@ class SEIFramePacking : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return FRAME_PACKING;}
+    PayloadType payloadType() const { return FRAME_PACKING; }
 
     SEIFramePacking() {}
 
@@ -322,7 +321,7 @@ class SEIDisplayOrientation : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return DISPLAY_ORIENTATION;}
+    PayloadType payloadType() const { return DISPLAY_ORIENTATION; }
 
     SEIDisplayOrientation()
         : cancelFlag(true)
@@ -353,7 +352,7 @@ class SEITemporalLevel0Index : public SE
 {
 public:
 
-    PayloadType payloadType() const { return TEMPORAL_LEVEL0_INDEX;}
+    PayloadType payloadType() const { return TEMPORAL_LEVEL0_INDEX; }
 
     SEITemporalLevel0Index()
         : tl0Idx(0)
@@ -370,7 +369,7 @@ class SEIGradualDecodingRefreshInfo : pu
 {
 public:
 
-    PayloadType payloadType() const { return REGION_REFRESH_INFO;}
+    PayloadType payloadType() const { return REGION_REFRESH_INFO; }
 
     SEIGradualDecodingRefreshInfo()
         : m_gdrForegroundFlag(0)
@@ -386,7 +385,7 @@ class SEISOPDescription : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return SOP_DESCRIPTION;}
+    PayloadType payloadType() const { return SOP_DESCRIPTION; }
 
     SEISOPDescription() {}
 
@@ -408,7 +407,7 @@ class SEIToneMappingInfo : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return TONE_MAPPING_INFO;}
+    PayloadType payloadType() const { return TONE_MAPPING_INFO; }
 
     SEIToneMappingInfo() {}
 
@@ -458,7 +457,7 @@ class SEIScalableNesting : public SEI
 {
 public:
 
-    PayloadType payloadType() const { return SCALABLE_NESTING;}
+    PayloadType payloadType() const { return SCALABLE_NESTING; }
 
     SEIScalableNesting() {}
 
--- a/source/Lib/TLibCommon/TComBitCounter.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitCounter.h	Tue Apr 23 11:07:40 2013 +0530
@@ -64,11 +64,11 @@ public:
 
     virtual ~TComBitCounter()   {}
 
-    Void        write(UInt /*uiBits*/, UInt uiNumberOfBits)  { m_uiBitCounter += uiNumberOfBits;}
+    Void        write(UInt /*uiBits*/, UInt uiNumberOfBits)  { m_uiBitCounter += uiNumberOfBits; }
 
-    Void        resetBits()                                    { m_uiBitCounter = 0;}
+    Void        resetBits()                                    { m_uiBitCounter = 0;               }
 
-    UInt getNumberOfWrittenBits() const { return m_uiBitCounter;}
+    UInt getNumberOfWrittenBits() const { return m_uiBitCounter; }
 };
 
 //! \}
--- a/source/Lib/TLibCommon/TComBitStream.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitStream.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -151,7 +151,6 @@ Void TComOutputBitstream::writeAlignZero
     {
         return;
     }
-
     m_fifo->push_back(m_held_bits);
     m_held_bits = 0;
     m_num_held_bits = 0;
@@ -167,6 +166,7 @@ Void   TComOutputBitstream::addSubstream
     UInt uiNumBits = pcSubstream->getNumberOfWrittenBits();
 
     const vector<uint8_t>& rbsp = pcSubstream->getFIFO();
+
     for (vector<uint8_t>::const_iterator it = rbsp.begin(); it != rbsp.end(); )
     {
         write(*it++, 8);
@@ -203,7 +203,6 @@ Int TComOutputBitstream::countStartCodeE
             {
                 break;
             }
-
             if (*(++found) <= 3)
             {
                 break;
@@ -352,9 +351,9 @@ TComOutputBitstream& TComOutputBitstream
 TComInputBitstream *TComInputBitstream::extractSubstream(UInt uiNumBits)
 {
     UInt uiNumBytes = uiNumBits / 8;
-
     std::vector<uint8_t>* buf = new std::vector<uint8_t>;
     UInt uiByte;
+
     for (UInt ui = 0; ui < uiNumBytes; ui++)
     {
         read(8, uiByte);
@@ -368,7 +367,6 @@ TComInputBitstream *TComInputBitstream::
         uiByte <<= 8 - (uiNumBits & 0x7);
         buf->push_back(uiByte);
     }
-
     return new TComInputBitstream(buf);
 }
 
--- a/source/Lib/TLibCommon/TComBitStream.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitStream.h	Tue Apr 23 11:07:40 2013 +0530
@@ -65,7 +65,7 @@ public:
     virtual Void        writeAlignZero() {}
 
     virtual Void        write(UInt uiBits, UInt uiNumberOfBits)  = 0;
-    virtual Void        resetBits()                                    = 0;
+    virtual Void        resetBits()                              = 0;
     virtual UInt getNumberOfWrittenBits() const = 0;
     virtual ~TComBitIf() {}
 };
@@ -110,7 +110,7 @@ public:
     Void        writeAlignZero();
 
     /** this function should never be called */
-    void resetBits() { assert(0);}
+    void resetBits() { assert(0); }
 
     // utility functions
 
@@ -136,25 +136,25 @@ public:
      * returns the number of bits that need to be written to
      * achieve byte alignment.
      */
-    Int getNumBitsUntilByteAligned() { return (8 - m_num_held_bits) & 0x7;}
+    Int getNumBitsUntilByteAligned() { return (8 - m_num_held_bits) & 0x7; }
 
     /**
      * Return the number of bits that have been written since the last clear()
      */
-    UInt getNumberOfWrittenBits() const { return UInt(m_fifo->size()) * 8 + m_num_held_bits;}
+    UInt getNumberOfWrittenBits() const { return UInt(m_fifo->size()) * 8 + m_num_held_bits; }
 
     void insertAt(const TComOutputBitstream& src, UInt pos);
 
     /**
      * Return a reference to the internal fifo
      */
-    std::vector<uint8_t>& getFIFO() { return *m_fifo;}
+    std::vector<uint8_t>& getFIFO() { return *m_fifo; }
 
-    UChar getHeldBits()          { return m_held_bits;}
+    UChar getHeldBits()          { return m_held_bits; }
 
     TComOutputBitstream& operator =(const TComOutputBitstream& src);
     /** Return a reference to the internal fifo */
-    std::vector<uint8_t>& getFIFO() const { return *m_fifo;}
+    std::vector<uint8_t>& getFIFO() const { return *m_fifo; }
 
     Void          addSubstream(TComOutputBitstream* pcSubstream);
     Void writeByteAlignment();
@@ -200,40 +200,40 @@ public:
     }
 
     Void        readOutTrailingBits();
-    UChar getHeldBits()          { return m_held_bits;}
+    UChar getHeldBits()          { return m_held_bits; }
 
     TComOutputBitstream& operator =(const TComOutputBitstream& src);
-    UInt  getByteLocation()                     { return m_fifo_idx;}
+    UInt  getByteLocation()      { return m_fifo_idx; }
 
     // Peek at bits in word-storage. Used in determining if we have completed reading of current bitstream and therefore slice in LCEC.
-    UInt        peekBits(UInt uiBits) { UInt tmp;pseudoRead(uiBits, tmp);return tmp;}
+    UInt        peekBits(UInt uiBits) { UInt tmp; pseudoRead(uiBits, tmp); return tmp; }
 
     // utility functions
-    UInt read(UInt numberOfBits) { UInt tmp;read(numberOfBits, tmp);return tmp;}
+    UInt read(UInt numberOfBits) { UInt tmp; read(numberOfBits, tmp); return tmp; }
 
-    UInt     readByte() { UInt tmp;readByte(tmp);return tmp;}
+    UInt     readByte() { UInt tmp; readByte(tmp); return tmp; }
 
-    UInt getNumBitsUntilByteAligned() { return m_num_held_bits & (0x7);}
+    UInt getNumBitsUntilByteAligned() { return m_num_held_bits & (0x7); }
 
-    UInt getNumBitsLeft() { return 8 * ((UInt)m_fifo->size() - m_fifo_idx) + m_num_held_bits;}
+    UInt getNumBitsLeft() { return 8 * ((UInt)m_fifo->size() - m_fifo_idx) + m_num_held_bits; }
 
     TComInputBitstream *extractSubstream(UInt uiNumBits); // Read the nominated number of bits, and return as a bitstream.
     Void                deleteFifo(); // Delete internal fifo of bitstream.
-    UInt  getNumBitsRead() { return m_numBitsRead;}
+    UInt  getNumBitsRead() { return m_numBitsRead; }
 
     Void readByteAlignment();
 
-    Void      pushEmulationPreventionByteLocation(UInt pos)                  { m_emulationPreventionByteLocation.push_back(pos);}
-
-    UInt      numEmulationPreventionBytesRead()                            { return (UInt)m_emulationPreventionByteLocation.size();}
+    Void      pushEmulationPreventionByteLocation(UInt pos)             { m_emulationPreventionByteLocation.push_back(pos); }
 
-    std::vector<UInt>  getEmulationPreventionByteLocation()                   { return m_emulationPreventionByteLocation;}
+    UInt      numEmulationPreventionBytesRead()                         { return (UInt)m_emulationPreventionByteLocation.size();    }
 
-    UInt      getEmulationPreventionByteLocation(UInt idx)                  { return m_emulationPreventionByteLocation[idx];}
+    std::vector<UInt>  getEmulationPreventionByteLocation()             { return m_emulationPreventionByteLocation;           }
 
-    Void      clearEmulationPreventionByteLocation()                            { m_emulationPreventionByteLocation.clear();}
+    UInt      getEmulationPreventionByteLocation(UInt idx)              { return m_emulationPreventionByteLocation[idx];    }
 
-    Void      setEmulationPreventionByteLocation(std::vector<UInt> vec)     { m_emulationPreventionByteLocation = vec;}
+    Void      clearEmulationPreventionByteLocation()                    { m_emulationPreventionByteLocation.clear();          }
+
+    Void      setEmulationPreventionByteLocation(std::vector<UInt> vec) { m_emulationPreventionByteLocation = vec;            }
 };
 
 //! \}
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -179,7 +179,6 @@ Void TComDataCU::create(UInt uiNumPartit
                 m_pcGlbArlCoeffCb  = (Int*)xMalloc(Int, uiWidth * uiHeight / 4);
                 m_pcGlbArlCoeffCr  = (Int*)xMalloc(Int, uiWidth * uiHeight / 4);
             }
-
             m_pcArlCoeffY        = m_pcGlbArlCoeffY;
             m_pcArlCoeffCb       = m_pcGlbArlCoeffCb;
             m_pcArlCoeffCr       = m_pcGlbArlCoeffCr;
@@ -191,7 +190,6 @@ Void TComDataCU::create(UInt uiNumPartit
             m_pcArlCoeffCb       = (Int*)xMalloc(Int, uiWidth * uiHeight / 4);
             m_pcArlCoeffCr       = (Int*)xMalloc(Int, uiWidth * uiHeight / 4);
         }
-
 #endif // if ADAPTIVE_QP_SELECTION
 
         m_pbIPCMFlag         = (Bool*)xMalloc(Bool, uiNumPartition);
@@ -239,52 +237,31 @@ Void TComDataCU::destroy()
     // encoder-side buffer free
     if (!m_bDecSubCu)
     {
-        if (m_phQP) { xFree(m_phQP);m_phQP              = NULL;}
-
-        if (m_puhDepth) { xFree(m_puhDepth);m_puhDepth          = NULL;}
-
-        if (m_puhWidth) { xFree(m_puhWidth);m_puhWidth          = NULL;}
-
-        if (m_puhHeight) { xFree(m_puhHeight);m_puhHeight         = NULL;}
-
-        if (m_skipFlag) { delete[] m_skipFlag;m_skipFlag          = NULL;}
-
-        if (m_pePartSize) { delete[] m_pePartSize;m_pePartSize        = NULL;}
-
-        if (m_pePredMode) { delete[] m_pePredMode;m_pePredMode        = NULL;}
-
-        if (m_CUTransquantBypass) { delete[] m_CUTransquantBypass;m_CUTransquantBypass = NULL;}
-
-        if (m_puhCbf[0]) { xFree(m_puhCbf[0]);m_puhCbf[0]         = NULL;}
-
-        if (m_puhCbf[1]) { xFree(m_puhCbf[1]);m_puhCbf[1]         = NULL;}
-
-        if (m_puhCbf[2]) { xFree(m_puhCbf[2]);m_puhCbf[2]         = NULL;}
-
-        if (m_puhInterDir) { xFree(m_puhInterDir);m_puhInterDir       = NULL;}
-
-        if (m_pbMergeFlag) { xFree(m_pbMergeFlag);m_pbMergeFlag       = NULL;}
-
-        if (m_puhMergeIndex) { xFree(m_puhMergeIndex);m_puhMergeIndex     = NULL;}
-
-        if (m_puhLumaIntraDir) { xFree(m_puhLumaIntraDir);m_puhLumaIntraDir   = NULL;}
-
-        if (m_puhChromaIntraDir) { xFree(m_puhChromaIntraDir);m_puhChromaIntraDir = NULL;}
-
-        if (m_puhTrIdx) { xFree(m_puhTrIdx);m_puhTrIdx          = NULL;}
-
-        if (m_puhTransformSkip[0]) { xFree(m_puhTransformSkip[0]);m_puhTransformSkip[0] = NULL;}
-
-        if (m_puhTransformSkip[1]) { xFree(m_puhTransformSkip[1]);m_puhTransformSkip[1] = NULL;}
-
-        if (m_puhTransformSkip[2]) { xFree(m_puhTransformSkip[2]);m_puhTransformSkip[2] = NULL;}
-
-        if (m_pcTrCoeffY) { xFree(m_pcTrCoeffY);m_pcTrCoeffY        = NULL;}
-
-        if (m_pcTrCoeffCb) { xFree(m_pcTrCoeffCb);m_pcTrCoeffCb       = NULL;}
-
-        if (m_pcTrCoeffCr) { xFree(m_pcTrCoeffCr);m_pcTrCoeffCr       = NULL;}
-
+        if (m_phQP) { xFree(m_phQP); m_phQP = NULL; }
+        if (m_puhDepth) { xFree(m_puhDepth); m_puhDepth = NULL; }
+        if (m_puhWidth) { xFree(m_puhWidth); m_puhWidth = NULL; }
+        if (m_puhHeight) { xFree(m_puhHeight); m_puhHeight = NULL; }
+
+        if (m_skipFlag) { delete[] m_skipFlag; m_skipFlag = NULL; }
+
+        if (m_pePartSize) { delete[] m_pePartSize; m_pePartSize = NULL; }
+        if (m_pePredMode) { delete[] m_pePredMode; m_pePredMode = NULL; }
+        if (m_CUTransquantBypass) { delete[] m_CUTransquantBypass; m_CUTransquantBypass = NULL; }
+        if (m_puhCbf[0]) { xFree(m_puhCbf[0]); m_puhCbf[0] = NULL; }
+        if (m_puhCbf[1]) { xFree(m_puhCbf[1]); m_puhCbf[1] = NULL; }
+        if (m_puhCbf[2]) { xFree(m_puhCbf[2]); m_puhCbf[2] = NULL; }
+        if (m_puhInterDir) { xFree(m_puhInterDir); m_puhInterDir = NULL; }
+        if (m_pbMergeFlag) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; }
+        if (m_puhMergeIndex) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; }
+        if (m_puhLumaIntraDir) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; }
+        if (m_puhChromaIntraDir) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; }
+        if (m_puhTrIdx) { xFree(m_puhTrIdx); m_puhTrIdx = NULL; }
+        if (m_puhTransformSkip[0]) { xFree(m_puhTransformSkip[0]); m_puhTransformSkip[0] = NULL; }
+        if (m_puhTransformSkip[1]) { xFree(m_puhTransformSkip[1]); m_puhTransformSkip[1] = NULL; }
+        if (m_puhTransformSkip[2]) { xFree(m_puhTransformSkip[2]); m_puhTransformSkip[2] = NULL; }
+        if (m_pcTrCoeffY) { xFree(m_pcTrCoeffY); m_pcTrCoeffY = NULL; }
+        if (m_pcTrCoeffCb) { xFree(m_pcTrCoeffCb); m_pcTrCoeffCb = NULL; }
+        if (m_pcTrCoeffCr) { xFree(m_pcTrCoeffCr); m_pcTrCoeffCr = NULL; }
 #if ADAPTIVE_QP_SELECTION
         if (!m_ArlCoeffIsAliasedAllocation)
         {
@@ -295,29 +272,18 @@ Void TComDataCU::destroy()
             xFree(m_pcArlCoeffCr);
             m_pcArlCoeffCr = 0;
         }
-
-        if (m_pcGlbArlCoeffY) { xFree(m_pcGlbArlCoeffY);m_pcGlbArlCoeffY    = NULL;}
-
-        if (m_pcGlbArlCoeffCb) { xFree(m_pcGlbArlCoeffCb);m_pcGlbArlCoeffCb   = NULL;}
-
-        if (m_pcGlbArlCoeffCr) { xFree(m_pcGlbArlCoeffCr);m_pcGlbArlCoeffCr   = NULL;}
-
+        if (m_pcGlbArlCoeffY) { xFree(m_pcGlbArlCoeffY); m_pcGlbArlCoeffY = NULL; }
+        if (m_pcGlbArlCoeffCb) { xFree(m_pcGlbArlCoeffCb); m_pcGlbArlCoeffCb = NULL; }
+        if (m_pcGlbArlCoeffCr) { xFree(m_pcGlbArlCoeffCr); m_pcGlbArlCoeffCr = NULL; }
 #endif // if ADAPTIVE_QP_SELECTION
-        if (m_pbIPCMFlag) { xFree(m_pbIPCMFlag);m_pbIPCMFlag        = NULL;}
-
-        if (m_pcIPCMSampleY) { xFree(m_pcIPCMSampleY);m_pcIPCMSampleY     = NULL;}
-
-        if (m_pcIPCMSampleCb) { xFree(m_pcIPCMSampleCb);m_pcIPCMSampleCb    = NULL;}
-
-        if (m_pcIPCMSampleCr) { xFree(m_pcIPCMSampleCr);m_pcIPCMSampleCr    = NULL;}
-
-        if (m_apiMVPIdx[0]) { delete[] m_apiMVPIdx[0];m_apiMVPIdx[0]      = NULL;}
-
-        if (m_apiMVPIdx[1]) { delete[] m_apiMVPIdx[1];m_apiMVPIdx[1]      = NULL;}
-
-        if (m_apiMVPNum[0]) { delete[] m_apiMVPNum[0];m_apiMVPNum[0]      = NULL;}
-
-        if (m_apiMVPNum[1]) { delete[] m_apiMVPNum[1];m_apiMVPNum[1]      = NULL;}
+        if (m_pbIPCMFlag) { xFree(m_pbIPCMFlag); m_pbIPCMFlag = NULL; }
+        if (m_pcIPCMSampleY) { xFree(m_pcIPCMSampleY); m_pcIPCMSampleY = NULL; }
+        if (m_pcIPCMSampleCb) { xFree(m_pcIPCMSampleCb); m_pcIPCMSampleCb = NULL; }
+        if (m_pcIPCMSampleCr) { xFree(m_pcIPCMSampleCr); m_pcIPCMSampleCr = NULL; }
+        if (m_apiMVPIdx[0]) { delete[] m_apiMVPIdx[0]; m_apiMVPIdx[0] = NULL; }
+        if (m_apiMVPIdx[1]) { delete[] m_apiMVPIdx[1]; m_apiMVPIdx[1] = NULL; }
+        if (m_apiMVPNum[0]) { delete[] m_apiMVPNum[0]; m_apiMVPNum[0] = NULL; }
+        if (m_apiMVPNum[1]) { delete[] m_apiMVPNum[1]; m_apiMVPNum[1] = NULL; }
 
         m_acCUMvField[0].destroy();
         m_acCUMvField[1].destroy();
@@ -336,7 +302,6 @@ Void TComDataCU::destroy()
         xFree(m_sliceStartCU);
         m_sliceStartCU = NULL;
     }
-
     if (m_sliceSegmentStartCU)
     {
         xFree(m_sliceSegmentStartCU);
@@ -406,8 +371,7 @@ Void TComDataCU::initCU(TComPic* pcPic, 
 
     for (Int i = 0; i < pcPic->getNumPartInCU(); i++)
     {
-        if (pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) * pcPic->getNumPartInCU() + i >=
-            getSlice()->getSliceSegmentCurStartCUAddr())
+        if (pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) * pcPic->getNumPartInCU() + i >= getSlice()->getSliceSegmentCurStartCUAddr())
         {
             m_sliceSegmentStartCU[i] = getSlice()->getSliceSegmentCurStartCUAddr();
         }
@@ -417,8 +381,7 @@ Void TComDataCU::initCU(TComPic* pcPic, 
         }
     }
 
-    Int partStartIdx = getSlice()->getSliceSegmentCurStartCUAddr() - pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) *
-        pcPic->getNumPartInCU();
+    Int partStartIdx = getSlice()->getSliceSegmentCurStartCUAddr() - pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) * pcPic->getNumPartInCU();
 
     Int numElements = min<Int>(partStartIdx, m_uiNumPartition);
     for (Int ui = 0; ui < numElements; ui++)
@@ -460,7 +423,7 @@ Void TComDataCU::initCU(TComPic* pcPic, 
 
         memset(m_pePartSize        + firstElement, SIZE_NONE,                numElements * sizeof(*m_pePartSize));
         memset(m_pePredMode        + firstElement, MODE_NONE,                numElements * sizeof(*m_pePredMode));
-        memset(m_CUTransquantBypass + firstElement, false,                    numElements * sizeof(*m_CUTransquantBypass));
+        memset(m_CUTransquantBypass + firstElement, false,                   numElements * sizeof(*m_CUTransquantBypass));
         memset(m_puhDepth          + firstElement, 0,                        numElements * sizeof(*m_puhDepth));
         memset(m_puhTrIdx          + firstElement, 0,                        numElements * sizeof(*m_puhTrIdx));
         memset(m_puhTransformSkip[0] + firstElement, 0,                      numElements * sizeof(*m_puhTransformSkip[0]));
@@ -591,8 +554,7 @@ Void TComDataCU::initEstData(UInt uiDept
 
     for (UInt ui = 0; ui < m_uiNumPartition; ui++)
     {
-        if (getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU + ui >=
-            getSlice()->getSliceSegmentCurStartCUAddr())
+        if (getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU + ui >= getSlice()->getSliceSegmentCurStartCUAddr())
         {
             m_apiMVPIdx[0][ui] = -1;
             m_apiMVPIdx[1][ui] = -1;
@@ -624,8 +586,7 @@ Void TComDataCU::initEstData(UInt uiDept
 
     UInt uiTmp = uhWidth * uhHeight;
 
-    if (getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU >=
-        getSlice()->getSliceSegmentCurStartCUAddr())
+    if (getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU >= getSlice()->getSliceSegmentCurStartCUAddr())
     {
         m_acCUMvField[0].clearMvField();
         m_acCUMvField[1].clearMvField();
@@ -705,8 +666,7 @@ Void TComDataCU::initSubCU(TComDataCU* p
         m_apiMVPIdx[1][ui] = -1;
         m_apiMVPNum[0][ui] = -1;
         m_apiMVPNum[1][ui] = -1;
-        if (m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU + ui <
-            getSlice()->getSliceSegmentCurStartCUAddr())
+        if (m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU + ui < getSlice()->getSliceSegmentCurStartCUAddr())
         {
             m_apiMVPIdx[0][ui] = pcCU->m_apiMVPIdx[0][uiPartOffset + ui];
             m_apiMVPIdx[1][ui] = pcCU->m_apiMVPIdx[1][uiPartOffset + ui];
@@ -754,8 +714,7 @@ Void TComDataCU::initSubCU(TComDataCU* p
     m_acCUMvField[0].clearMvField();
     m_acCUMvField[1].clearMvField();
 
-    if (m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU <
-        getSlice()->getSliceSegmentCurStartCUAddr())
+    if (m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) * m_pcPic->getNumPartInCU() + m_uiAbsIdxInLCU < getSlice()->getSliceSegmentCurStartCUAddr())
     {
         // Part of this CU contains data from an older slice. Now copy in that data.
         UInt uiMaxCuWidth = pcCU->getSlice()->getSPS()->getMaxCUWidth();
@@ -1049,8 +1008,7 @@ Void TComDataCU::copyToPic(UChar uhDepth
 
     memcpy(rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof(*m_pePartSize) * m_uiNumPartition);
     memcpy(rpcCU->getPredictionMode() + m_uiAbsIdxInLCU, m_pePredMode, sizeof(*m_pePredMode) * m_uiNumPartition);
-    memcpy(
-        rpcCU->getCUTransquantBypass() + m_uiAbsIdxInLCU, m_CUTransquantBypass, sizeof(*m_CUTransquantBypass) * m_uiNumPartition);
+    memcpy(rpcCU->getCUTransquantBypass() + m_uiAbsIdxInLCU, m_CUTransquantBypass, sizeof(*m_CUTransquantBypass) * m_uiNumPartition);
     memcpy(rpcCU->getMergeFlag()         + m_uiAbsIdxInLCU, m_pbMergeFlag,         iSizeInBool);
     memcpy(rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar);
     memcpy(rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar);
@@ -1204,18 +1162,13 @@ TComDataCU* TComDataCU::getPULeft(UInt& 
 
     uiLPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdx + uiNumPartInCUWidth - 1];
 
-    if ((bEnforceSliceRestriction &&
-         (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL || m_pcCULeft->getSCUAddr() + uiLPartUnitIdx <
-          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx)))
+    if ((bEnforceSliceRestriction && (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL || m_pcCULeft->getSCUAddr() + uiLPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx)))
         ||
-        (bEnforceTileRestriction &&
-         (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL ||
-          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
+        (bEnforceTileRestriction && (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL || (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
         )
     {
         return NULL;
     }
-
     return m_pcCULeft;
 }
 
@@ -1250,18 +1203,13 @@ TComDataCU* TComDataCU::getPUAbove(UInt&
 
     uiAPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdx + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth];
 
-    if ((bEnforceSliceRestriction &&
-         (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL || m_pcCUAbove->getSCUAddr() + uiAPartUnitIdx <
-          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx)))
+    if ((bEnforceSliceRestriction && (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL || m_pcCUAbove->getSCUAddr() + uiAPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx)))
         ||
-        (bEnforceTileRestriction &&
-         (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL ||
-          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
+        (bEnforceTileRestriction && (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL || (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
         )
     {
         return NULL;
     }
-
     return m_pcCUAbove;
 }
 
@@ -1286,19 +1234,15 @@ TComDataCU* TComDataCU::getPUAboveLeft(U
                 return this;
             }
         }
-
         uiALPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdx + getPic()->getNumPartInCU() - uiNumPartInCUWidth - 1];
         if ((bEnforceSliceRestriction && (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL ||
-                                          m_pcCUAbove->getSCUAddr() + uiALPartUnitIdx <
-                                          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) !=
-                                           m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                          m_pcCUAbove->getSCUAddr() + uiALPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                           ))
             )
         {
             return NULL;
         }
-
         return m_pcCUAbove;
     }
 
@@ -1306,31 +1250,25 @@ TComDataCU* TComDataCU::getPUAboveLeft(U
     {
         uiALPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdx - 1];
         if ((bEnforceSliceRestriction && (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL ||
-                                          m_pcCULeft->getSCUAddr() + uiALPartUnitIdx <
-                                          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) !=
-                                           m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                          m_pcCULeft->getSCUAddr() + uiALPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                           ))
             )
         {
             return NULL;
         }
-
         return m_pcCULeft;
     }
 
     uiALPartUnitIdx = g_auiRasterToZscan[m_pcPic->getNumPartInCU() - 1];
     if ((bEnforceSliceRestriction && (m_pcCUAboveLeft == NULL || m_pcCUAboveLeft->getSlice() == NULL ||
-                                      m_pcCUAboveLeft->getSCUAddr() + uiALPartUnitIdx <
-                                      m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                      (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAboveLeft->getAddr()) !=
-                                       m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                      m_pcCUAboveLeft->getSCUAddr() + uiALPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                      (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAboveLeft->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                       ))
         )
     {
         return NULL;
     }
-
     return m_pcCUAboveLeft;
 }
 
@@ -1340,8 +1278,7 @@ TComDataCU* TComDataCU::getPUAboveRight(
     UInt uiAbsZorderCUIdx   = g_auiZscanToRaster[m_uiAbsIdxInLCU] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1;
     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
 
-    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth()) >=
-        m_pcSlice->getSPS()->getPicWidthInLumaSamples())
+    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth()) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples())
     {
         uiARPartUnitIdx = MAX_UINT;
         return NULL;
@@ -1364,23 +1301,18 @@ TComDataCU* TComDataCU::getPUAboveRight(
                     return this;
                 }
             }
-
             uiARPartUnitIdx = MAX_UINT;
             return NULL;
         }
-
         uiARPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + 1];
         if ((bEnforceSliceRestriction && (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL ||
-                                          m_pcCUAbove->getSCUAddr() + uiARPartUnitIdx <
-                                          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) !=
-                                           m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                          m_pcCUAbove->getSCUAddr() + uiARPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                           ))
             )
         {
             return NULL;
         }
-
         return m_pcCUAbove;
     }
 
@@ -1392,30 +1324,24 @@ TComDataCU* TComDataCU::getPUAboveRight(
 
     uiARPartUnitIdx = g_auiRasterToZscan[m_pcPic->getNumPartInCU() - uiNumPartInCUWidth];
     if ((bEnforceSliceRestriction && (m_pcCUAboveRight == NULL || m_pcCUAboveRight->getSlice() == NULL ||
-                                      m_pcPic->getPicSym()->getInverseCUOrderMap(m_pcCUAboveRight->getAddr()) >
-                                      m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) ||
-                                      m_pcCUAboveRight->getSCUAddr() + uiARPartUnitIdx <
-                                      m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                      (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAboveRight->getAddr()) !=
-                                       m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                      m_pcPic->getPicSym()->getInverseCUOrderMap(m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) ||
+                                      m_pcCUAboveRight->getSCUAddr() + uiARPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                      (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAboveRight->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                       ))
         )
     {
         return NULL;
     }
-
     return m_pcCUAboveRight;
 }
 
 TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction)
 {
     UInt uiAbsPartIdxLB     = g_auiZscanToRaster[uiCurrPartUnitIdx];
-    UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[m_uiAbsIdxInLCU] +
-        (m_puhHeight[0] / m_pcPic->getMinCUHeight() - 1) * m_pcPic->getNumPartInWidth();
+    UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[m_uiAbsIdxInLCU] + (m_puhHeight[0] / m_pcPic->getMinCUHeight() - 1) * m_pcPic->getNumPartInWidth();
     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
 
-    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight()) >=
-        m_pcSlice->getSPS()->getPicHeightInLumaSamples())
+    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight()) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
     {
         uiBLPartUnitIdx = MAX_UINT;
         return NULL;
@@ -1438,23 +1364,18 @@ TComDataCU* TComDataCU::getPUBelowLeft(U
                     return this;
                 }
             }
-
             uiBLPartUnitIdx = MAX_UINT;
             return NULL;
         }
-
         uiBLPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdxLB + uiNumPartInCUWidth * 2 - 1];
         if ((bEnforceSliceRestriction && (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL ||
-                                          m_pcCULeft->getSCUAddr() + uiBLPartUnitIdx <
-                                          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) !=
-                                           m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                          m_pcCULeft->getSCUAddr() + uiBLPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                           ))
             )
         {
             return NULL;
         }
-
         return m_pcCULeft;
     }
 
@@ -1462,18 +1383,13 @@ TComDataCU* TComDataCU::getPUBelowLeft(U
     return NULL;
 }
 
-TComDataCU* TComDataCU::getPUBelowLeftAdi(UInt& uiBLPartUnitIdx,
-                                          UInt  uiCurrPartUnitIdx,
-                                          UInt  uiPartUnitOffset,
-                                          Bool  bEnforceSliceRestriction)
+TComDataCU* TComDataCU::getPUBelowLeftAdi(UInt& uiBLPartUnitIdx,  UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction)
 {
     UInt uiAbsPartIdxLB     = g_auiZscanToRaster[uiCurrPartUnitIdx];
-    UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[m_uiAbsIdxInLCU] +
-        ((m_puhHeight[0] / m_pcPic->getMinCUHeight()) - 1) * m_pcPic->getNumPartInWidth();
+    UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[m_uiAbsIdxInLCU] + ((m_puhHeight[0] / m_pcPic->getMinCUHeight()) - 1) * m_pcPic->getNumPartInWidth();
     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
 
-    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] +
-         (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
+    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
     {
         uiBLPartUnitIdx = MAX_UINT;
         return NULL;
@@ -1496,23 +1412,18 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
                     return this;
                 }
             }
-
             uiBLPartUnitIdx = MAX_UINT;
             return NULL;
         }
-
         uiBLPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdxLB + (1 + uiPartUnitOffset) * uiNumPartInCUWidth - 1];
         if ((bEnforceSliceRestriction && (m_pcCULeft == NULL || m_pcCULeft->getSlice() == NULL ||
-                                          m_pcCULeft->getSCUAddr() + uiBLPartUnitIdx <
-                                          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) !=
-                                           m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                          m_pcCULeft->getSCUAddr() + uiBLPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCULeft->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                           ))
             )
         {
             return NULL;
         }
-
         return m_pcCULeft;
     }
 
@@ -1520,17 +1431,13 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
     return NULL;
 }
 
-TComDataCU* TComDataCU::getPUAboveRightAdi(UInt& uiARPartUnitIdx,
-                                           UInt  uiCurrPartUnitIdx,
-                                           UInt  uiPartUnitOffset,
-                                           Bool  bEnforceSliceRestriction)
+TComDataCU* TComDataCU::getPUAboveRightAdi(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction)
 {
     UInt uiAbsPartIdxRT     = g_auiZscanToRaster[uiCurrPartUnitIdx];
     UInt uiAbsZorderCUIdx   = g_auiZscanToRaster[m_uiAbsIdxInLCU] + (m_puhWidth[0] / m_pcPic->getMinCUWidth()) - 1;
     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
 
-    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] +
-         (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples())
+    if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples())
     {
         uiARPartUnitIdx = MAX_UINT;
         return NULL;
@@ -1553,23 +1460,18 @@ TComDataCU* TComDataCU::getPUAboveRightA
                     return this;
                 }
             }
-
             uiARPartUnitIdx = MAX_UINT;
             return NULL;
         }
-
         uiARPartUnitIdx = g_auiRasterToZscan[uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset];
         if ((bEnforceSliceRestriction && (m_pcCUAbove == NULL || m_pcCUAbove->getSlice() == NULL ||
-                                          m_pcCUAbove->getSCUAddr() + uiARPartUnitIdx <
-                                          m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) !=
-                                           m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                          m_pcCUAbove->getSCUAddr() + uiARPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                          (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAbove->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                           ))
             )
         {
             return NULL;
         }
-
         return m_pcCUAbove;
     }
 
@@ -1581,18 +1483,14 @@ TComDataCU* TComDataCU::getPUAboveRightA
 
     uiARPartUnitIdx = g_auiRasterToZscan[m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset - 1];
     if ((bEnforceSliceRestriction && (m_pcCUAboveRight == NULL || m_pcCUAboveRight->getSlice() == NULL ||
-                                      m_pcPic->getPicSym()->getInverseCUOrderMap(m_pcCUAboveRight->getAddr()) >
-                                      m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) ||
-                                      m_pcCUAboveRight->getSCUAddr() + uiARPartUnitIdx <
-                                      m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
-                                      (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAboveRight->getAddr()) !=
-                                       m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
+                                      m_pcPic->getPicSym()->getInverseCUOrderMap(m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr()) ||
+                                      m_pcCUAboveRight->getSCUAddr() + uiARPartUnitIdx < m_pcPic->getCU(getAddr())->getSliceStartCU(uiCurrPartUnitIdx) ||
+                                      (m_pcPic->getPicSym()->getTileIdxMap(m_pcCUAboveRight->getAddr()) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
                                       ))
         )
     {
         return NULL;
     }
-
     return m_pcCUAboveRight;
 }
 
@@ -1604,10 +1502,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
 TComDataCU* TComDataCU::getQpMinCuLeft(UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInLCU)
 {
     UInt numPartInCUWidth = m_pcPic->getNumPartInWidth();
-    UInt absZorderQpMinCUIdx =
-        (uiCurrAbsIdxInLCU >>
-         ((g_uiMaxCUDepth -
-           getSlice()->getPPS()->getMaxCuDQPDepth()) << 1)) << ((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth()) << 1);
+    UInt absZorderQpMinCUIdx = (uiCurrAbsIdxInLCU >> ((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth()) << 1)) << ((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth()) << 1);
     UInt absRorderQpMinCUIdx = g_auiZscanToRaster[absZorderQpMinCUIdx];
 
     // check for left LCU boundary
@@ -1631,10 +1526,7 @@ TComDataCU* TComDataCU::getQpMinCuLeft(U
 TComDataCU* TComDataCU::getQpMinCuAbove(UInt& aPartUnitIdx, UInt currAbsIdxInLCU)
 {
     UInt numPartInCUWidth = m_pcPic->getNumPartInWidth();
-    UInt absZorderQpMinCUIdx =
-        (currAbsIdxInLCU >>
-         ((g_uiMaxCUDepth -
-           getSlice()->getPPS()->getMaxCuDQPDepth()) << 1)) << ((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth()) << 1);
+    UInt absZorderQpMinCUIdx = (currAbsIdxInLCU >> ((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth()) << 1)) << ((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth()) << 1);
     UInt absRorderQpMinCUIdx = g_auiZscanToRaster[absZorderQpMinCUIdx];
 
     // check for top LCU boundary
@@ -1660,8 +1552,7 @@ Char TComDataCU::getRefQP(UInt uiCurrAbs
     TComDataCU* cULeft  = getQpMinCuLeft(lPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU);
     TComDataCU* cUAbove = getQpMinCuAbove(aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU);
 
-    return ((cULeft ? cULeft->getQP(lPartIdx) : getLastCodedQP(uiCurrAbsIdxInLCU)) +
-            (cUAbove ? cUAbove->getQP(aPartIdx) : getLastCodedQP(uiCurrAbsIdxInLCU)) + 1) >> 1;
+    return ((cULeft ? cULeft->getQP(lPartIdx) : getLastCodedQP(uiCurrAbsIdxInLCU)) + (cUAbove ? cUAbove->getQP(aPartIdx) : getLastCodedQP(uiCurrAbsIdxInLCU)) + 1) >> 1;
 }
 
 Int TComDataCU::getLastValidPartIdx(Int iAbsPartIdx)
@@ -1699,14 +1590,10 @@ Char TComDataCU::getLastCodedQP(UInt uiA
             return getPic()->getCU(getAddr())->getLastCodedQP(getZorderIdxInCU());
         }
         else if (getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) > 0
-                 && getPic()->getPicSym()->getTileIdxMap(getAddr()) ==
-                 getPic()->getPicSym()->getTileIdxMap(getPic()->getPicSym()->getCUOrderMap(getPic()->getPicSym()->
-                                                                                           getInverseCUOrderMap(
-                                                                                               getAddr()) - 1))
+                 && getPic()->getPicSym()->getTileIdxMap(getAddr()) == getPic()->getPicSym()->getTileIdxMap(getPic()->getPicSym()->getCUOrderMap(getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) - 1))
                  && !(getSlice()->getPPS()->getEntropyCodingSyncEnabledFlag() && getAddr() % getPic()->getFrameWidthInCU() == 0))
         {
-            return getPic()->getCU(getPic()->getPicSym()->getCUOrderMap(getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) -
-                                                                        1))->getLastCodedQP(getPic()->getNumPartInCU());
+            return getPic()->getCU(getPic()->getPicSym()->getCUOrderMap(getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) - 1))->getLastCodedQP(getPic()->getNumPartInCU());
         }
         else
         {
@@ -1800,7 +1687,6 @@ Int TComDataCU::getIntraDirLumaPredictor
         {
             *piMode = 2;
         }
-
         uiIntraDirPred[0] = iLeftIntraDir;
         uiIntraDirPred[1] = iAboveIntraDir;
 
@@ -1851,8 +1737,7 @@ UInt TComDataCU::getQuadtreeTULog2MinSiz
 {
     UInt log2CbSize = g_aucConvertToBit[getWidth(absPartIdx)] + 2;
     PartSize  partSize  = getPartitionSize(absPartIdx);
-    UInt quadtreeTUMaxDepth = getPredictionMode(absPartIdx) ==
-        MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
+    UInt quadtreeTUMaxDepth = getPredictionMode(absPartIdx) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
     Int intraSplitFlag = (getPredictionMode(absPartIdx) == MODE_INTRA && partSize == SIZE_NxN) ? 1 : 0;
     Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode(absPartIdx) == MODE_INTER) && (partSize != SIZE_2Nx2N));
 
@@ -1873,7 +1758,6 @@ UInt TComDataCU::getQuadtreeTULog2MinSiz
             log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize();
         }
     }
-
     return log2MinTUSizeInCU;
 }
 
@@ -1981,8 +1865,7 @@ Void TComDataCU::setQPSubCUs(Int qp, TCo
         }
         else
         {
-            if (pcCU->getCbf(absPartIdx,
-                             TEXT_LUMA) || pcCU->getCbf(absPartIdx, TEXT_CHROMA_U) || pcCU->getCbf(absPartIdx, TEXT_CHROMA_V))
+            if (pcCU->getCbf(absPartIdx, TEXT_LUMA) || pcCU->getCbf(absPartIdx, TEXT_CHROMA_U) || pcCU->getCbf(absPartIdx, TEXT_CHROMA_V))
             {
                 foundNonZeroCbf = true;
             }
@@ -2001,8 +1884,7 @@ Void TComDataCU::setQPSubParts(Int qp, U
 
     for (UInt uiSCUIdx = uiAbsPartIdx; uiSCUIdx < uiAbsPartIdx + uiCurrPartNumb; uiSCUIdx++)
     {
-        if (m_pcPic->getCU(getAddr())->getSliceSegmentStartCU(uiSCUIdx + getZorderIdxInCU()) ==
-            pcSlice->getSliceSegmentCurStartCUAddr())
+        if (m_pcPic->getCU(getAddr())->getSliceSegmentStartCU(uiSCUIdx + getZorderIdxInCU()) == pcSlice->getSliceSegmentCurStartCUAddr())
         {
             m_phQP[uiSCUIdx] = qp;
         }
@@ -2052,7 +1934,6 @@ Void TComDataCU::setSubPart(T uiParamete
         {
             assert(0);
         }
-
         break;
     case SIZE_2NxnD:
         if (uiPUIdx == 0)
@@ -2069,7 +1950,6 @@ Void TComDataCU::setSubPart(T uiParamete
         {
             assert(0);
         }
-
         break;
     case SIZE_nLx2N:
         if (uiPUIdx == 0)
@@ -2084,14 +1964,12 @@ Void TComDataCU::setSubPart(T uiParamete
             memset(puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2));
             memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)));
             memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2));
-            memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter,
-                   (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)));
+            memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)));
         }
         else
         {
             assert(0);
         }
-
         break;
     case SIZE_nRx2N:
         if (uiPUIdx == 0)
@@ -2099,8 +1977,7 @@ Void TComDataCU::setSubPart(T uiParamete
             memset(puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)));
             memset(puhBaseLCU + uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2));
             memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)));
-            memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter,
-                   (uiCurrPartNumQ >> 2));
+            memset(puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2));
         }
         else if (uiPUIdx == 1)
         {
@@ -2113,7 +1990,6 @@ Void TComDataCU::setSubPart(T uiParamete
         {
             assert(0);
         }
-
         break;
     default:
         assert(0);
@@ -2159,11 +2035,7 @@ Void TComDataCU::setTrIdxSubParts(UInt u
     memset(m_puhTrIdx + uiAbsPartIdx, uiTrIdx, sizeof(UChar) * uiCurrPartNumb);
 }
 
-Void TComDataCU::setTransformSkipSubParts(UInt useTransformSkipY,
-                                          UInt useTransformSkipU,
-                                          UInt useTransformSkipV,
-                                          UInt uiAbsPartIdx,
-                                          UInt uiDepth)
+Void TComDataCU::setTransformSkipSubParts(UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth)
 {
     UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
 
@@ -2309,7 +2181,6 @@ Void TComDataCU::deriveLeftRightTopIdxGe
         {
             assert(0);
         }
-
         break;
     case SIZE_nRx2N:
         if (uiPartIdx == 0)
@@ -2324,7 +2195,6 @@ Void TComDataCU::deriveLeftRightTopIdxGe
         {
             assert(0);
         }
-
         break;
     default:
         assert(0);
@@ -2361,7 +2231,6 @@ Void TComDataCU::deriveLeftBottomIdxGene
         {
             assert(0);
         }
-
         break;
     case SIZE_2NxnD:
         if (uiPartIdx == 0)
@@ -2376,7 +2245,6 @@ Void TComDataCU::deriveLeftBottomIdxGene
         {
             assert(0);
         }
-
         break;
     case SIZE_nLx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx];
         break;
@@ -2387,10 +2255,7 @@ Void TComDataCU::deriveLeftBottomIdxGene
         break;
     }
 
-    ruiPartIdxLB      =
-        g_auiRasterToZscan[g_auiZscanToRaster[m_uiAbsIdxInLCU +
-                                              uiAbsPartIdx] +
-                           ((uiPUHeight / m_pcPic->getMinCUHeight()) - 1) * m_pcPic->getNumPartInWidth()];
+    ruiPartIdxLB      = g_auiRasterToZscan[g_auiZscanToRaster[m_uiAbsIdxInLCU + uiAbsPartIdx] + ((uiPUHeight / m_pcPic->getMinCUHeight()) - 1) * m_pcPic->getNumPartInWidth()];
 }
 
 Void TComDataCU::deriveLeftRightTopIdx(UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT)
@@ -2400,8 +2265,7 @@ Void TComDataCU::deriveLeftRightTopIdx(U
 
     switch (m_pePartSize[0])
     {
-    case SIZE_2Nx2N:
-        break;
+    case SIZE_2Nx2N:                                                                                                                                break;
     case SIZE_2NxN:
         ruiPartIdxLT += (uiPartIdx == 0) ? 0 : m_uiNumPartition >> 1;
         ruiPartIdxRT += (uiPartIdx == 0) ? 0 : m_uiNumPartition >> 1;
@@ -2438,9 +2302,7 @@ Void TComDataCU::deriveLeftRightTopIdx(U
 
 Void TComDataCU::deriveLeftBottomIdx(UInt uiPartIdx,      UInt&      ruiPartIdxLB)
 {
-    ruiPartIdxLB      =
-        g_auiRasterToZscan[g_auiZscanToRaster[m_uiAbsIdxInLCU] +
-                           (((m_puhHeight[0] / m_pcPic->getMinCUHeight()) >> 1) - 1) * m_pcPic->getNumPartInWidth()];
+    ruiPartIdxLB      = g_auiRasterToZscan[g_auiZscanToRaster[m_uiAbsIdxInLCU] + (((m_puhHeight[0] / m_pcPic->getMinCUHeight()) >> 1) - 1) * m_pcPic->getNumPartInWidth()];
 
     switch (m_pePartSize[0])
     {
@@ -2466,8 +2328,7 @@ Void TComDataCU::deriveLeftBottomIdx(UIn
         ruiPartIdxLB += (uiPartIdx == 0) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 4);
         break;
     case SIZE_nRx2N:
-        ruiPartIdxLB +=
-            (uiPartIdx == 0) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4);
+        ruiPartIdxLB += (uiPartIdx == 0) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4);
         break;
     default:
         assert(0);
@@ -2482,11 +2343,7 @@ Void TComDataCU::deriveLeftBottomIdx(UIn
  */
 Void TComDataCU::deriveRightBottomIdx(UInt uiPartIdx,      UInt&      ruiPartIdxRB)
 {
-    ruiPartIdxRB      =
-        g_auiRasterToZscan[g_auiZscanToRaster[m_uiAbsIdxInLCU] +
-                           (((m_puhHeight[0] /
-                              m_pcPic->getMinCUHeight()) >>
-                             1) - 1) * m_pcPic->getNumPartInWidth() +  m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1];
+    ruiPartIdxRB      = g_auiRasterToZscan[g_auiZscanToRaster[m_uiAbsIdxInLCU] + (((m_puhHeight[0] / m_pcPic->getMinCUHeight()) >> 1) - 1) * m_pcPic->getNumPartInWidth() +  m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1];
 
     switch (m_pePartSize[0])
     {
@@ -2512,9 +2369,7 @@ Void TComDataCU::deriveRightBottomIdx(UI
         ruiPartIdxRB += (uiPartIdx == 0) ? (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1;
         break;
     case SIZE_nRx2N:
-        ruiPartIdxRB +=
-            (uiPartIdx == 0) ? (m_uiNumPartition >>
-                                2) + (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1;
+        ruiPartIdxRB += (uiPartIdx == 0) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1;
         break;
     default:
         assert(0);
@@ -2553,10 +2408,8 @@ Bool TComDataCU::hasEqualMotion(UInt uiA
     {
         if (getInterDir(uiAbsPartIdx) & (1 << uiRefListIdx))
         {
-            if (getCUMvField(RefPicList(uiRefListIdx))->getMv(uiAbsPartIdx)     !=
-                pcCandCU->getCUMvField(RefPicList(uiRefListIdx))->getMv(uiCandAbsPartIdx) ||
-                getCUMvField(RefPicList(uiRefListIdx))->getRefIdx(uiAbsPartIdx) !=
-                pcCandCU->getCUMvField(RefPicList(uiRefListIdx))->getRefIdx(uiCandAbsPartIdx))
+            if (getCUMvField(RefPicList(uiRefListIdx))->getMv(uiAbsPartIdx)     != pcCandCU->getCUMvField(RefPicList(uiRefListIdx))->getMv(uiCandAbsPartIdx) ||
+                getCUMvField(RefPicList(uiRefListIdx))->getRefIdx(uiAbsPartIdx) != pcCandCU->getCUMvField(RefPicList(uiRefListIdx))->getRefIdx(uiCandAbsPartIdx))
             {
                 return false;
             }
@@ -2574,12 +2427,7 @@ Bool TComDataCU::hasEqualMotion(UInt uiA
  * \param puhInterDirNeighbours
  * \param numValidMergeCand
  */
-Void TComDataCU::getInterMergeCandidates(UInt         uiAbsPartIdx,
-                                         UInt         uiPUIdx,
-                                         TComMvField* pcMvFieldNeighbours,
-                                         UChar*       puhInterDirNeighbours,
-                                         Int&         numValidMergeCand,
-                                         Int          mrgCandIdx)
+Void TComDataCU::getInterMergeCandidates(UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx)
 {
     UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
     Bool abCandIsInter[MRG_MAX_NUM_CANDS];
@@ -2622,12 +2470,10 @@ Void TComDataCU::getInterMergeCandidates
         {
             pcCULeft->getMvField(pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount << 1) + 1]);
         }
-
         if (mrgCandIdx == iCount)
         {
             return;
         }
-
         iCount++;
     }
 
@@ -2636,7 +2482,6 @@ Void TComDataCU::getInterMergeCandidates
     {
         return;
     }
-
     // above
     UInt uiAbovePartIdx = 0;
     TComDataCU* pcCUAbove = 0;
@@ -2656,15 +2501,12 @@ Void TComDataCU::getInterMergeCandidates
         {
             pcCUAbove->getMvField(pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount << 1) + 1]);
         }
-
         if (mrgCandIdx == iCount)
         {
             return;
         }
-
         iCount++;
     }
-
     // early termination
     if (iCount == getSlice()->getMaxNumMergeCand())
     {
@@ -2687,20 +2529,14 @@ Void TComDataCU::getInterMergeCandidates
         pcCUAboveRight->getMvField(pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount << 1]);
         if (getSlice()->isInterB())
         {
-            pcCUAboveRight->getMvField(pcCUAboveRight,
-                                       uiAboveRightPartIdx,
-                                       REF_PIC_LIST_1,
-                                       pcMvFieldNeighbours[(iCount << 1) + 1]);
+            pcCUAboveRight->getMvField(pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount << 1) + 1]);
         }
-
         if (mrgCandIdx == iCount)
         {
             return;
         }
-
         iCount++;
     }
-
     // early termination
     if (iCount == getSlice()->getMaxNumMergeCand())
     {
@@ -2723,26 +2559,19 @@ Void TComDataCU::getInterMergeCandidates
         pcCULeftBottom->getMvField(pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount << 1]);
         if (getSlice()->isInterB())
         {
-            pcCULeftBottom->getMvField(pcCULeftBottom,
-                                       uiLeftBottomPartIdx,
-                                       REF_PIC_LIST_1,
-                                       pcMvFieldNeighbours[(iCount << 1) + 1]);
+            pcCULeftBottom->getMvField(pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount << 1) + 1]);
         }
-
         if (mrgCandIdx == iCount)
         {
             return;
         }
-
         iCount++;
     }
-
     // early termination
     if (iCount == getSlice()->getMaxNumMergeCand())
     {
         return;
     }
-
     // above left
     if (iCount < 4)
     {
@@ -2762,25 +2591,20 @@ Void TComDataCU::getInterMergeCandidates
             pcCUAboveLeft->getMvField(pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount << 1]);
             if (getSlice()->isInterB())
             {
-                pcCUAboveLeft->getMvField(pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1,
-                                          pcMvFieldNeighbours[(iCount << 1) + 1]);
+                pcCUAboveLeft->getMvField(pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount << 1) + 1]);
             }
-
             if (mrgCandIdx == iCount)
             {
                 return;
             }
-
             iCount++;
         }
     }
-
     // early termination
     if (iCount == getSlice()->getMaxNumMergeCand())
     {
         return;
     }
-
     if (getSlice()->getEnableTMVPFlag())
     {
         //>> MTK colocated-RightBottom
@@ -2795,13 +2619,11 @@ Void TComDataCU::getInterMergeCandidates
         TComMv cColMv;
         Int iRefIdx;
 
-        if      ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth()) >=
-                 m_pcSlice->getSPS()->getPicWidthInLumaSamples())                                                                                                               // image boundary check
+        if      ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth()) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
         {
             uiLCUIdx = -1;
         }
-        else if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight()) >=
-                 m_pcSlice->getSPS()->getPicHeightInLumaSamples())
+        else if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight()) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
         {
             uiLCUIdx = -1;
         }
@@ -2842,7 +2664,6 @@ Void TComDataCU::getInterMergeCandidates
         {
             bExistMV = xGetColMVP(REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx);
         }
-
         if (bExistMV)
         {
             dir |= 1;
@@ -2856,7 +2677,6 @@ Void TComDataCU::getInterMergeCandidates
             {
                 bExistMV = xGetColMVP(REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx);
             }
-
             if (bExistMV)
             {
                 dir |= 2;
@@ -2873,17 +2693,14 @@ Void TComDataCU::getInterMergeCandidates
             {
                 return;
             }
-
             iCount++;
         }
     }
-
     // early termination
     if (iCount == getSlice()->getMaxNumMergeCand())
     {
         return;
     }
-
     UInt uiArrayAddr = iCount;
     UInt uiCutoff = uiArrayAddr;
 
@@ -2902,15 +2719,12 @@ Void TComDataCU::getInterMergeCandidates
                 puhInterDirNeighbours[uiArrayAddr] = 3;
 
                 // get Mv from cand[i] and cand[j]
-                pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(
-                    pcMvFieldNeighbours[i << 1].getMv(), pcMvFieldNeighbours[i << 1].getRefIdx());
-                pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(
-                    pcMvFieldNeighbours[(j << 1) + 1].getMv(), pcMvFieldNeighbours[(j << 1) + 1].getRefIdx());
+                pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i << 1].getMv(), pcMvFieldNeighbours[i << 1].getRefIdx());
+                pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(pcMvFieldNeighbours[(j << 1) + 1].getMv(), pcMvFieldNeighbours[(j << 1) + 1].getRefIdx());
 
                 Int iRefPOCL0 = m_pcSlice->getRefPOC(REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr << 1)].getRefIdx());
                 Int iRefPOCL1 = m_pcSlice->getRefPOC(REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].getRefIdx());
-                if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr << 1)].getMv() ==
-                    pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].getMv())
+                if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr << 1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].getMv())
                 {
                     abCandIsInter[uiArrayAddr] = false;
                 }
@@ -2921,16 +2735,12 @@ Void TComDataCU::getInterMergeCandidates
             }
         }
     }
-
     // early termination
     if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
     {
         return;
     }
-
-    Int iNumRefIdx =
-        (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0),
-                                       m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
+    Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
     Int r = 0;
     Int refcnt = 0;
     while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
@@ -2944,7 +2754,6 @@ Void TComDataCU::getInterMergeCandidates
             puhInterDirNeighbours[uiArrayAddr] = 3;
             pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
         }
-
         uiArrayAddr++;
         if (refcnt == iNumRefIdx - 1)
         {
@@ -2973,12 +2782,10 @@ Bool TComDataCU::isDiffMER(Int xN, Int y
     {
         return true;
     }
-
     if ((yN >> plevel) != (yP >> plevel))
     {
         return true;
     }
-
     return false;
 }
 
@@ -3101,7 +2908,6 @@ Void TComDataCU::fillMvpCand(UInt uiPart
             bAdded = xAddMVPCandOrder(pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT);
         }
     }
-
     // Above predictor search
     bAdded = xAddMVPCand(pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT);
 
@@ -3114,7 +2920,6 @@ Void TComDataCU::fillMvpCand(UInt uiPart
     {
         bAdded = xAddMVPCand(pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
     }
-
     bAdded = bAddedSmvp;
     if (pInfo->iN == 2) bAdded = true;
 
@@ -3155,13 +2960,11 @@ Void TComDataCU::fillMvpCand(UInt uiPart
 
         //----  co-located RightBottom Temporal Predictor (H) ---//
         uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];
-        if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth()) >=
-            m_pcSlice->getSPS()->getPicWidthInLumaSamples())                                                                                                            // image boundary check
+        if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth()) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
         {
             uiLCUIdx = -1;
         }
-        else if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight()) >=
-                 m_pcSlice->getSPS()->getPicHeightInLumaSamples())
+        else if ((m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight()) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
         {
             uiLCUIdx = -1;
         }
@@ -3189,7 +2992,6 @@ Void TComDataCU::fillMvpCand(UInt uiPart
                 uiLCUIdx      = -1;
             }
         }
-
         if (uiLCUIdx >= 0 && xGetColMVP(eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col))
         {
             pInfo->m_acMvCand[pInfo->iN++] = cColMv;
@@ -3204,7 +3006,6 @@ Void TComDataCU::fillMvpCand(UInt uiPart
                 pInfo->m_acMvCand[pInfo->iN++] = cColMv;
             }
         }
-
         //----  co-located RightBottom Temporal Predictor  ---//
     }
 
@@ -3212,7 +3013,6 @@ Void TComDataCU::fillMvpCand(UInt uiPart
     {
         pInfo->iN = AMVP_MAX_NUM_CANDS;
     }
-
     while (pInfo->iN < AMVP_MAX_NUM_CANDS)
     {
         pInfo->m_acMvCand[pInfo->iN].set(0, 0);
@@ -3231,7 +3031,6 @@ Bool TComDataCU::isBipredRestriction(UIn
     {
         return true;
     }
-
     return false;
 }
 
@@ -3251,9 +3050,7 @@ Void TComDataCU::clipMv(TComMv& rcMv)
 
 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx)
 {
-    UInt uiShift =
-        ((m_puhTrIdx[uiAbsPartIdx] == 0) &&
-         (m_pePartSize[uiAbsPartIdx] == SIZE_NxN)) ? m_puhTrIdx[uiAbsPartIdx] + 1 : m_puhTrIdx[uiAbsPartIdx];
+    UInt uiShift = ((m_puhTrIdx[uiAbsPartIdx] == 0) && (m_pePartSize[uiAbsPartIdx] == SIZE_NxN)) ? m_puhTrIdx[uiAbsPartIdx] + 1 : m_puhTrIdx[uiAbsPartIdx];
 
     uiShift = (m_pePartSize[uiAbsPartIdx] == SIZE_NxN ? 1 : 0);
 
@@ -3299,9 +3096,9 @@ Bool TComDataCU::isSkipped(UInt uiPartId
 // ====================================================================================================================
 // Protected member functions
 // ====================================================================================================================
-
-#if _MSC_VER
-#pragma warning(disable: 4701) // potentially uninitialized local variables
+
+#if _MSC_VER
+#pragma warning(disable: 4701) // potentially uninitialized local variables
 #endif
 
 Bool TComDataCU::xAddMVPCand(AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir)
@@ -3348,10 +3145,7 @@ Bool TComDataCU::xAddMVPCand(AMVPInfo* p
     }
 
 #if L0363_MVP_POC
-    if (pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 &&
-        m_pcSlice->getRefPic(eRefPicList,
-                             iRefIdx)->getPOC() ==
-        pcTmpCU->getSlice()->getRefPOC(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx)))
+    if (pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx)))
 #else
     if (m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx))
 #endif
@@ -3385,7 +3179,6 @@ Bool TComDataCU::xAddMVPCand(AMVPInfo* p
             return true;
         }
     }
-
     return false;
 }
 
@@ -3464,8 +3257,7 @@ Bool TComDataCU::xAddMVPCandOrder(AMVPIn
         TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
         TComMv rcMv;
 
-        bIsNeibRefLongTerm =
-            pcTmpCU->getSlice()->getRefPic(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx))->getIsLongTerm();
+        bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx))->getIsLongTerm();
         if (bIsCurrRefLongTerm == bIsNeibRefLongTerm)
         {
             if (bIsCurrRefLongTerm || bIsNeibRefLongTerm)
@@ -3484,12 +3276,10 @@ Bool TComDataCU::xAddMVPCandOrder(AMVPIn
                     rcMv = cMvPred.scaleMv(iScale);
                 }
             }
-
             pInfo->m_acMvCand[pInfo->iN++] = rcMv;
             return true;
         }
     }
-
     //---------------------- V2(END) --------------------//
     if (pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0)
     {
@@ -3497,9 +3287,7 @@ Bool TComDataCU::xAddMVPCandOrder(AMVPIn
         TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
         TComMv rcMv;
 
-        bIsNeibRefLongTerm =
-            pcTmpCU->getSlice()->getRefPic(eRefPicList2nd,
-                                           pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getIsLongTerm();
+        bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getIsLongTerm();
         if (bIsCurrRefLongTerm == bIsNeibRefLongTerm)
         {
             if (bIsCurrRefLongTerm || bIsNeibRefLongTerm)
@@ -3518,12 +3306,10 @@ Bool TComDataCU::xAddMVPCandOrder(AMVPIn
                     rcMv = cMvPred.scaleMv(iScale);
                 }
             }
-
             pInfo->m_acMvCand[pInfo->iN++] = rcMv;
             return true;
         }
     }
-
     //---------------------- V3(END) --------------------//
     return false;
 }
@@ -3544,16 +3330,13 @@ Bool TComDataCU::xGetColMVP(RefPicList e
     TComMv cColMv;
 
     // use coldir.
-    TComPic *pColPic = getSlice()->getRefPic(RefPicList(
-                                                 getSlice()->isInterB() ? 1 - getSlice()->getColFromL0Flag() : 0),
-                                             getSlice()->getColRefIdx());
+    TComPic *pColPic = getSlice()->getRefPic(RefPicList(getSlice()->isInterB() ? 1 - getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
     TComDataCU *pColCU = pColPic->getCU(uiCUAddr);
 
     if (pColCU->getPic() == 0 || pColCU->getPartitionSize(uiPartUnitIdx) == SIZE_NONE)
     {
         return false;
     }
-
     iCurrPOC = m_pcSlice->getPOC();
     iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     iColPOC = pColCU->getSlice()->getPOC();
@@ -3562,7 +3345,6 @@ Bool TComDataCU::xGetColMVP(RefPicList e
     {
         return false;
     }
-
     eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag());
 
     Int iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr);
@@ -3607,7 +3389,6 @@ Bool TComDataCU::xGetColMVP(RefPicList e
             rcMv = cColMv.scaleMv(iScale);
         }
     }
-
     return true;
 }
 
@@ -3733,7 +3514,6 @@ UInt TComDataCU::getCoefScanIdx(UInt uiA
             // get luma mode from upper-left corner of current CU
             uiDirMode = getLumaIntraDir((uiAbsPartIdx / numParts) * numParts);
         }
-
         uiScanIdx = SCAN_DIAG;
         if (uiCTXIdx > 4 && uiCTXIdx < 7) //if multiple scans supported for transform size
         {
@@ -3746,8 +3526,7 @@ UInt TComDataCU::getCoefScanIdx(UInt uiA
 
 UInt TComDataCU::getSCUAddr()
 {
-    return getPic()->getPicSym()->getInverseCUOrderMap(m_uiCUAddr) *
-           (1 << (m_pcSlice->getSPS()->getMaxCUDepth() << 1)) + m_uiAbsIdxInLCU;
+    return getPic()->getPicSym()->getInverseCUOrderMap(m_uiCUAddr) * (1 << (m_pcSlice->getSPS()->getMaxCUDepth() << 1)) + m_uiAbsIdxInLCU;
 }
 
 /** Set neighboring blocks availabilities for non-deblocked filtering
@@ -3764,21 +3543,10 @@ UInt TComDataCU::getSCUAddr()
  * \param bRightTileBoundary true means that right boundary coincides tile boundary
  * \param bIndependentTileBoundaryEnabled true for independent tile boundary enabled
  */
-Void TComDataCU::setNDBFilterBlockBorderAvailability(UInt               numLCUInPicWidth,
-                                                     UInt /*numLCUInPicHeight*/,
-                                                     UInt               numSUInLCUWidth,
-                                                     UInt               numSUInLCUHeight,
-                                                     UInt               picWidth,
-                                                     UInt               picHeight
-                                                     ,
-                                                     std::vector<Bool>& LFCrossSliceBoundary
-                                                     ,
-                                                     Bool               bTopTileBoundary,
-                                                     Bool               bDownTileBoundary,
-                                                     Bool               bLeftTileBoundary,
-                                                     Bool               bRightTileBoundary
-                                                     ,
-                                                     Bool               bIndependentTileBoundaryEnabled)
+Void TComDataCU::setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt /*numLCUInPicHeight*/, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight
+                                                     , std::vector<Bool>& LFCrossSliceBoundary
+                                                     , Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary
+                                                     , Bool bIndependentTileBoundaryEnabled)
 {
     UInt numSUInLCU = numSUInLCUWidth * numSUInLCUHeight;
     Int* pSliceIDMapLCU = m_piSliceSUMap;
@@ -3851,11 +3619,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU   = g_auiRasterToZscan[rTLSU - 1];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_R
@@ -3882,11 +3647,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU       = g_auiRasterToZscan[rTLSU + widthSU];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_T
@@ -3913,11 +3675,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU       = g_auiRasterToZscan[rTLSU - numSUInLCUWidth];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_B
@@ -3944,11 +3703,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU       = g_auiRasterToZscan[rTLSU + (heightSU * numSUInLCUWidth)];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_TL
@@ -3983,11 +3739,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU       = g_auiRasterToZscan[rTLSU - numSUInLCUWidth - 1];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_TR
@@ -4022,11 +3775,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU       = g_auiRasterToZscan[rTLSU - numSUInLCUWidth + widthSU];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_BL
@@ -4061,11 +3811,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU       = g_auiRasterToZscan[rTLSU + heightSU * numSUInLCUWidth - 1];
                 pRefMapLCU  = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         //       SGU_BR
@@ -4100,11 +3847,8 @@ Void TComDataCU::setNDBFilterBlockBorder
                 zRefSU      = g_auiRasterToZscan[rTLSU + (heightSU * numSUInLCUWidth) + widthSU];
                 pRefMapLCU = pSliceIDMapLCU;
             }
-
             pRefID = pRefMapLCU + zRefSU;
-            *pbAvail =
-                (*pRefID ==
-                 sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
+            *pbAvail = (*pRefID == sliceID) ? (true) : ((*pRefID > sliceID) ? (LFCrossSliceBoundary[*pRefID]) : (LFCrossSliceBoundary[sliceID]));
         }
 
         if (bIndependentTileBoundaryEnabled)
@@ -4117,7 +3861,6 @@ Void TComDataCU::setNDBFilterBlockBorder
                     pbAvailBorder[SGU_L] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_BL] = false;
                 }
             }
-
             //right LCU boundary
             if (!bPicRBoundary && bLCURBoundary)
             {
@@ -4126,7 +3869,6 @@ Void TComDataCU::setNDBFilterBlockBorder
                     pbAvailBorder[SGU_R] = pbAvailBorder[SGU_TR] = pbAvailBorder[SGU_BR] = false;
                 }
             }
-
             //top LCU boundary
             if (!bPicTBoundary && bLCUTBoundary)
             {
@@ -4135,7 +3877,6 @@ Void TComDataCU::setNDBFilterBlockBorder
                     pbAvailBorder[SGU_T] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_TR] = false;
                 }
             }
-
             //down LCU boundary
             if (!bPicBBoundary && bLCUBBoundary)
             {
@@ -4145,7 +3886,6 @@ Void TComDataCU::setNDBFilterBlockBorder
                 }
             }
         }
-
         rSGU.allBordersAvailable = true;
         for (Int b = 0; b < NUM_SGU_BORDER; b++)
         {
--- a/source/Lib/TLibCommon/TComDataCU.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.h	Tue Apr 23 11:07:40 2013 +0530
@@ -250,26 +250,26 @@ public:
     // member functions for CU description
     // -------------------------------------------------------------------------------------------------------------------
 
-    TComPic*      getPic()                        { return m_pcPic;}
+    TComPic*      getPic()                        { return m_pcPic; }
 
-    TComSlice*    getSlice()                        { return m_pcSlice;}
+    TComSlice*    getSlice()                        { return m_pcSlice; }
 
-    UInt&         getAddr()                        { return m_uiCUAddr;}
+    UInt&         getAddr()                        { return m_uiCUAddr; }
 
-    UInt&         getZorderIdxInCU()                        { return m_uiAbsIdxInLCU;}
+    UInt&         getZorderIdxInCU()                        { return m_uiAbsIdxInLCU; }
 
     UInt          getSCUAddr();
-    UInt          getCUPelX()                        { return m_uiCUPelX;}
-
-    UInt          getCUPelY()                        { return m_uiCUPelY;}
+    UInt          getCUPelX()                        { return m_uiCUPelX; }
 
-    TComPattern*  getPattern()                        { return m_pcPattern;}
+    UInt          getCUPelY()                        { return m_uiCUPelY; }
 
-    UChar*        getDepth()                        { return m_puhDepth;}
+    TComPattern*  getPattern()                        { return m_pcPattern; }
 
-    UChar         getDepth(UInt uiIdx)            { return m_puhDepth[uiIdx];}
+    UChar*        getDepth()                        { return m_puhDepth; }
 
-    Void          setDepth(UInt uiIdx, UChar  uh) { m_puhDepth[uiIdx] = uh;}
+    UChar         getDepth(UInt uiIdx)            { return m_puhDepth[uiIdx]; }
+
+    Void          setDepth(UInt uiIdx, UChar  uh) { m_puhDepth[uiIdx] = uh; }
 
     Void          setDepthSubParts(UInt uiDepth, UInt uiAbsPartIdx);
 
@@ -277,123 +277,113 @@ public:
     // member functions for CU data
     // -------------------------------------------------------------------------------------------------------------------
 
-    Char*         getPartitionSize()                        { return m_pePartSize;}
+    Char*         getPartitionSize()                        { return m_pePartSize; }
 
-    PartSize      getPartitionSize(UInt uiIdx)            { return static_cast<PartSize>(m_pePartSize[uiIdx]);}
+    PartSize      getPartitionSize(UInt uiIdx)            { return static_cast<PartSize>(m_pePartSize[uiIdx]); }
 
-    Void          setPartitionSize(UInt uiIdx, PartSize uh) { m_pePartSize[uiIdx] = (Char)uh;}
+    Void          setPartitionSize(UInt uiIdx, PartSize uh) { m_pePartSize[uiIdx] = (Char)uh; }
 
     Void          setPartSizeSubParts(PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth);
     Void          setCUTransquantBypassSubParts(Bool flag, UInt uiAbsPartIdx, UInt uiDepth);
 
-    Bool*        getSkipFlag()                        { return m_skipFlag;}
+    Bool*        getSkipFlag()                        { return m_skipFlag; }
 
-    Bool         getSkipFlag(UInt idx)                { return m_skipFlag[idx];}
+    Bool         getSkipFlag(UInt idx)                { return m_skipFlag[idx]; }
 
-    Void         setSkipFlag(UInt idx, Bool skip)     { m_skipFlag[idx] = skip;}
+    Void         setSkipFlag(UInt idx, Bool skip)     { m_skipFlag[idx] = skip; }
 
     Void         setSkipFlagSubParts(Bool skip, UInt absPartIdx, UInt depth);
 
-    Char*         getPredictionMode()                        { return m_pePredMode;}
-
-    PredMode      getPredictionMode(UInt uiIdx)            { return static_cast<PredMode>(m_pePredMode[uiIdx]);}
+    Char*         getPredictionMode()                        { return m_pePredMode; }
 
-    Bool*         getCUTransquantBypass()                        { return m_CUTransquantBypass;}
+    PredMode      getPredictionMode(UInt uiIdx)            { return static_cast<PredMode>(m_pePredMode[uiIdx]); }
 
-    Bool          getCUTransquantBypass(UInt uiIdx)             { return m_CUTransquantBypass[uiIdx];}
+    Bool*         getCUTransquantBypass()                        { return m_CUTransquantBypass; }
 
-    Void          setPredictionMode(UInt uiIdx, PredMode uh) { m_pePredMode[uiIdx] = (Char)uh;}
+    Bool          getCUTransquantBypass(UInt uiIdx)             { return m_CUTransquantBypass[uiIdx]; }
+
+    Void          setPredictionMode(UInt uiIdx, PredMode uh) { m_pePredMode[uiIdx] = (Char)uh; }
 
     Void          setPredModeSubParts(PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth);
 
-    UChar*        getWidth()                        { return m_puhWidth;}
-
-    UChar         getWidth(UInt uiIdx)            { return m_puhWidth[uiIdx];}
+    UChar*        getWidth()                        { return m_puhWidth; }
 
-    Void          setWidth(UInt uiIdx, UChar  uh) { m_puhWidth[uiIdx] = uh;}
+    UChar         getWidth(UInt uiIdx)            { return m_puhWidth[uiIdx]; }
 
-    UChar*        getHeight()                        { return m_puhHeight;}
+    Void          setWidth(UInt uiIdx, UChar  uh) { m_puhWidth[uiIdx] = uh; }
 
-    UChar         getHeight(UInt uiIdx)            { return m_puhHeight[uiIdx];}
+    UChar*        getHeight()                        { return m_puhHeight; }
 
-    Void          setHeight(UInt uiIdx, UChar  uh) { m_puhHeight[uiIdx] = uh;}
+    UChar         getHeight(UInt uiIdx)            { return m_puhHeight[uiIdx]; }
+
+    Void          setHeight(UInt uiIdx, UChar  uh) { m_puhHeight[uiIdx] = uh; }
 
     Void          setSizeSubParts(UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth);
 
-    Char*         getQP()                        { return m_phQP;}
+    Char*         getQP()                        { return m_phQP; }
 
-    Char          getQP(UInt uiIdx)            { return m_phQP[uiIdx];}
+    Char          getQP(UInt uiIdx)            { return m_phQP[uiIdx]; }
 
-    Void          setQP(UInt uiIdx, Char value) { m_phQP[uiIdx] =  value;}
+    Void          setQP(UInt uiIdx, Char value) { m_phQP[uiIdx] =  value; }
 
     Void          setQPSubParts(Int qp,   UInt uiAbsPartIdx, UInt uiDepth);
     Int           getLastValidPartIdx(Int iAbsPartIdx);
     Char          getLastCodedQP(UInt uiAbsPartIdx);
     Void          setQPSubCUs(Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf);
-    Void          setCodedQP(Char qp)               { m_codedQP = qp;}
+    Void          setCodedQP(Char qp)               { m_codedQP = qp; }
 
-    Char          getCodedQP()                        { return m_codedQP;}
+    Char          getCodedQP()                        { return m_codedQP; }
 
     Bool          isLosslessCoded(UInt absPartIdx);
 
-    UChar*        getTransformIdx()                        { return m_puhTrIdx;}
+    UChar*        getTransformIdx()                        { return m_puhTrIdx; }
 
-    UChar         getTransformIdx(UInt uiIdx)            { return m_puhTrIdx[uiIdx];}
+    UChar         getTransformIdx(UInt uiIdx)            { return m_puhTrIdx[uiIdx]; }
 
     Void          setTrIdxSubParts(UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth);
 
-    UChar*        getTransformSkip(TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];}
+    UChar*        getTransformSkip(TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]]; }
 
-    UChar         getTransformSkip(UInt     uiIdx,
-                                   TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];}
+    UChar         getTransformSkip(UInt uiIdx, TextType eType)    { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; }
 
     Void          setTransformSkipSubParts(UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth);
-    Void          setTransformSkipSubParts(UInt useTransformSkipY,
-                                           UInt useTransformSkipU,
-                                           UInt useTransformSkipV,
-                                           UInt uiAbsPartIdx,
-                                           UInt uiDepth);
+    Void          setTransformSkipSubParts(UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth);
 
     UInt          getQuadtreeTULog2MinSizeInCU(UInt absPartIdx);
 
-    TComCUMvField* getCUMvField(RefPicList e)          { return &m_acCUMvField[e];}
+    TComCUMvField* getCUMvField(RefPicList e)          { return &m_acCUMvField[e]; }
 
-    TCoeff*&      getCoeffY()                        { return m_pcTrCoeffY;}
+    TCoeff*&      getCoeffY()                        { return m_pcTrCoeffY; }
 
-    TCoeff*&      getCoeffCb()                        { return m_pcTrCoeffCb;}
+    TCoeff*&      getCoeffCb()                        { return m_pcTrCoeffCb; }
 
-    TCoeff*&      getCoeffCr()                        { return m_pcTrCoeffCr;}
+    TCoeff*&      getCoeffCr()                        { return m_pcTrCoeffCr; }
 
 #if ADAPTIVE_QP_SELECTION
-    Int*&         getArlCoeffY()                        { return m_pcArlCoeffY;}
+    Int*&         getArlCoeffY()                        { return m_pcArlCoeffY; }
 
-    Int*&         getArlCoeffCb()                        { return m_pcArlCoeffCb;}
+    Int*&         getArlCoeffCb()                        { return m_pcArlCoeffCb; }
 
-    Int*&         getArlCoeffCr()                        { return m_pcArlCoeffCr;}
+    Int*&         getArlCoeffCr()                        { return m_pcArlCoeffCr; }
 
 #endif
 
-    Pel*&         getPCMSampleY()                        { return m_pcIPCMSampleY;}
-
-    Pel*&         getPCMSampleCb()                        { return m_pcIPCMSampleCb;}
-
-    Pel*&         getPCMSampleCr()                        { return m_pcIPCMSampleCr;}
+    Pel*&         getPCMSampleY()                        { return m_pcIPCMSampleY; }
 
-    UChar         getCbf(UInt uiIdx, TextType eType)                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx];}
+    Pel*&         getPCMSampleCb()                        { return m_pcIPCMSampleCb; }
 
-    UChar*        getCbf(TextType eType)                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]];}
+    Pel*&         getPCMSampleCr()                        { return m_pcIPCMSampleCr; }
 
-    UChar         getCbf(UInt uiIdx, TextType eType, UInt uiTrDepth)  { return (getCbf(uiIdx, eType) >> uiTrDepth) & 0x1;}
+    UChar         getCbf(UInt uiIdx, TextType eType)                  { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; }
 
-    Void          setCbf(UInt uiIdx, TextType eType, UChar uh)        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh;}
+    UChar*        getCbf(TextType eType)                              { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; }
+
+    UChar         getCbf(UInt uiIdx, TextType eType, UInt uiTrDepth)  { return (getCbf(uiIdx, eType) >> uiTrDepth) & 0x1; }
+
+    Void          setCbf(UInt uiIdx, TextType eType, UChar uh)        { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; }
 
     Void          clearCbf(UInt uiIdx, TextType eType, UInt uiNumParts);
-    UChar         getQtRootCbf(UInt uiIdx)
-    {
-        return getCbf(uiIdx, TEXT_LUMA, 0) ||
-               getCbf(uiIdx, TEXT_CHROMA_U, 0) ||
-               getCbf(uiIdx, TEXT_CHROMA_V, 0);
-    }
+    UChar         getQtRootCbf(UInt uiIdx)                      { return getCbf(uiIdx, TEXT_LUMA, 0) || getCbf(uiIdx, TEXT_CHROMA_U, 0) || getCbf(uiIdx, TEXT_CHROMA_V, 0); }
 
     Void          setCbfSubParts(UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth);
     Void          setCbfSubParts(UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth);
@@ -403,88 +393,77 @@ public:
     // member functions for coding tool information
     // -------------------------------------------------------------------------------------------------------------------
 
-    Bool*         getMergeFlag()                        { return m_pbMergeFlag;}
+    Bool*         getMergeFlag()                        { return m_pbMergeFlag; }
 
-    Bool          getMergeFlag(UInt uiIdx)            { return m_pbMergeFlag[uiIdx];}
+    Bool          getMergeFlag(UInt uiIdx)            { return m_pbMergeFlag[uiIdx]; }
 
-    Void          setMergeFlag(UInt uiIdx, Bool b)    { m_pbMergeFlag[uiIdx] = b;}
+    Void          setMergeFlag(UInt uiIdx, Bool b)    { m_pbMergeFlag[uiIdx] = b; }
 
     Void          setMergeFlagSubParts(Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
 
-    UChar*        getMergeIndex()                        { return m_puhMergeIndex;}
+    UChar*        getMergeIndex()                        { return m_puhMergeIndex; }
 
-    UChar         getMergeIndex(UInt uiIdx)            { return m_puhMergeIndex[uiIdx];}
+    UChar         getMergeIndex(UInt uiIdx)            { return m_puhMergeIndex[uiIdx]; }
 
-    Void          setMergeIndex(UInt uiIdx, UInt uiMergeIndex) { m_puhMergeIndex[uiIdx] = (UChar)uiMergeIndex;}
+    Void          setMergeIndex(UInt uiIdx, UInt uiMergeIndex) { m_puhMergeIndex[uiIdx] = (UChar)uiMergeIndex; }
 
     Void          setMergeIndexSubParts(UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
     template<typename T>
     Void          setSubPart(T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx);
 
 #if AMP_MRG
-    Void          setMergeAMP(Bool b)      { m_bIsMergeAMP = b;}
+    Void          setMergeAMP(Bool b)      { m_bIsMergeAMP = b; }
 
-    Bool          getMergeAMP()             { return m_bIsMergeAMP;}
+    Bool          getMergeAMP()             { return m_bIsMergeAMP; }
 
 #endif
 
-    UChar*        getLumaIntraDir()                        { return m_puhLumaIntraDir;}
+    UChar*        getLumaIntraDir()                        { return m_puhLumaIntraDir; }
 
-    UChar         getLumaIntraDir(UInt uiIdx)            { return m_puhLumaIntraDir[uiIdx];}
+    UChar         getLumaIntraDir(UInt uiIdx)            { return m_puhLumaIntraDir[uiIdx]; }
 
-    Void          setLumaIntraDir(UInt uiIdx, UChar  uh) { m_puhLumaIntraDir[uiIdx] = uh;}
+    Void          setLumaIntraDir(UInt uiIdx, UChar  uh) { m_puhLumaIntraDir[uiIdx] = uh; }
 
     Void          setLumaIntraDirSubParts(UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth);
 
-    UChar*        getChromaIntraDir()                        { return m_puhChromaIntraDir;}
+    UChar*        getChromaIntraDir()                        { return m_puhChromaIntraDir; }
 
-    UChar         getChromaIntraDir(UInt uiIdx)            { return m_puhChromaIntraDir[uiIdx];}
+    UChar         getChromaIntraDir(UInt uiIdx)            { return m_puhChromaIntraDir[uiIdx]; }
 
-    Void          setChromaIntraDir(UInt uiIdx, UChar  uh) { m_puhChromaIntraDir[uiIdx] = uh;}
+    Void          setChromaIntraDir(UInt uiIdx, UChar  uh) { m_puhChromaIntraDir[uiIdx] = uh; }
 
     Void          setChromIntraDirSubParts(UInt uiDir,  UInt uiAbsPartIdx, UInt uiDepth);
 
-    UChar*        getInterDir()                        { return m_puhInterDir;}
+    UChar*        getInterDir()                        { return m_puhInterDir; }
 
-    UChar         getInterDir(UInt uiIdx)            { return m_puhInterDir[uiIdx];}
+    UChar         getInterDir(UInt uiIdx)            { return m_puhInterDir[uiIdx]; }
 
-    Void          setInterDir(UInt uiIdx, UChar  uh) { m_puhInterDir[uiIdx] = uh;}
+    Void          setInterDir(UInt uiIdx, UChar  uh) { m_puhInterDir[uiIdx] = uh; }
 
     Void          setInterDirSubParts(UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
-    Bool*         getIPCMFlag()                        { return m_pbIPCMFlag;}
+    Bool*         getIPCMFlag()                        { return m_pbIPCMFlag; }
 
-    Bool          getIPCMFlag(UInt uiIdx)             { return m_pbIPCMFlag[uiIdx];}
+    Bool          getIPCMFlag(UInt uiIdx)             { return m_pbIPCMFlag[uiIdx]; }
 
-    Void          setIPCMFlag(UInt uiIdx, Bool b)     { m_pbIPCMFlag[uiIdx] = b;}
+    Void          setIPCMFlag(UInt uiIdx, Bool b)     { m_pbIPCMFlag[uiIdx] = b; }
 
     Void          setIPCMFlagSubParts(Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
 
     /// get slice ID for SU
-    Int           getSUSliceID(UInt uiIdx)              { return m_piSliceSUMap[uiIdx];}
+    Int           getSUSliceID(UInt uiIdx)              { return m_piSliceSUMap[uiIdx]; }
 
     /// get the pointer of slice ID map
-    Int*          getSliceSUMap()                        { return m_piSliceSUMap;}
+    Int*          getSliceSUMap()                        { return m_piSliceSUMap; }
 
     /// set the pointer of slice ID map
-    Void          setSliceSUMap(Int *pi)                 { m_piSliceSUMap = pi;}
-
-    std::vector<NDBFBlockInfo>* getNDBFilterBlocks()      { return &m_vNDFBlock;}
+    Void          setSliceSUMap(Int *pi)                 { m_piSliceSUMap = pi; }
 
-    Void setNDBFilterBlockBorderAvailability(UInt               numLCUInPicWidth,
-                                             UInt               numLCUInPicHeight,
-                                             UInt               numSUInLCUWidth,
-                                             UInt               numSUInLCUHeight,
-                                             UInt               picWidth,
-                                             UInt               picHeight
-                                             ,
-                                             std::vector<Bool>& LFCrossSliceBoundary
-                                             ,
-                                             Bool               bTopTileBoundary,
-                                             Bool               bDownTileBoundary,
-                                             Bool               bLeftTileBoundary,
-                                             Bool               bRightTileBoundary
-                                             ,
-                                             Bool               bIndependentTileBoundaryEnabled);
+    std::vector<NDBFBlockInfo>* getNDBFilterBlocks()      { return &m_vNDFBlock; }
+
+    Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight
+                                             , std::vector<Bool>& LFCrossSliceBoundary
+                                             , Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary
+                                             , Bool bIndependentTileBoundaryEnabled);
     // -------------------------------------------------------------------------------------------------------------------
     // member functions for accessing partition information
     // -------------------------------------------------------------------------------------------------------------------
@@ -502,27 +481,27 @@ public:
     Void          fillMvpCand(UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo);
     Bool          isDiffMER(Int xN, Int yN, Int xP, Int yP);
     Void          getPartPosition(UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
-    Void          setMVPIdx(RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = (Char)iMVPIdx;}
-
-    Int           getMVPIdx(RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];}
+    Void          setMVPIdx(RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = (Char)iMVPIdx; }
 
-    Char*         getMVPIdx(RefPicList eRefPicList)                          { return m_apiMVPIdx[eRefPicList];}
+    Int           getMVPIdx(RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx]; }
 
-    Void          setMVPNum(RefPicList eRefPicList, UInt uiIdx, Int iMVPNum) { m_apiMVPNum[eRefPicList][uiIdx] = (Char)iMVPNum;}
+    Char*         getMVPIdx(RefPicList eRefPicList)                          { return m_apiMVPIdx[eRefPicList]; }
 
-    Int           getMVPNum(RefPicList eRefPicList, UInt uiIdx)              { return m_apiMVPNum[eRefPicList][uiIdx];}
+    Void          setMVPNum(RefPicList eRefPicList, UInt uiIdx, Int iMVPNum) { m_apiMVPNum[eRefPicList][uiIdx] = (Char)iMVPNum; }
 
-    Char*         getMVPNum(RefPicList eRefPicList)                          { return m_apiMVPNum[eRefPicList];}
+    Int           getMVPNum(RefPicList eRefPicList, UInt uiIdx)              { return m_apiMVPNum[eRefPicList][uiIdx]; }
+
+    Char*         getMVPNum(RefPicList eRefPicList)                          { return m_apiMVPNum[eRefPicList]; }
 
     Void          setMVPIdxSubParts(Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
     Void          setMVPNumSubParts(Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
 
     Void          clipMv(TComMv& rcMv);
-    Void          getMvPredLeft(TComMv& rcMvPred)   { rcMvPred = m_cMvFieldA.getMv();}
+    Void          getMvPredLeft(TComMv& rcMvPred)   { rcMvPred = m_cMvFieldA.getMv(); }
 
-    Void          getMvPredAbove(TComMv& rcMvPred)   { rcMvPred = m_cMvFieldB.getMv();}
+    Void          getMvPredAbove(TComMv& rcMvPred)   { rcMvPred = m_cMvFieldB.getMv(); }
 
-    Void          getMvPredAboveRight(TComMv& rcMvPred)   { rcMvPred = m_cMvFieldC.getMv();}
+    Void          getMvPredAboveRight(TComMv& rcMvPred)   { rcMvPred = m_cMvFieldC.getMv(); }
 
     Void          compressMV();
 
@@ -530,15 +509,15 @@ public:
     // utility functions for neighbouring information
     // -------------------------------------------------------------------------------------------------------------------
 
-    TComDataCU*   getCULeft() { return m_pcCULeft;}
-
-    TComDataCU*   getCUAbove() { return m_pcCUAbove;}
+    TComDataCU*   getCULeft() { return m_pcCULeft; }
 
-    TComDataCU*   getCUAboveLeft() { return m_pcCUAboveLeft;}
+    TComDataCU*   getCUAbove() { return m_pcCUAbove; }
 
-    TComDataCU*   getCUAboveRight() { return m_pcCUAboveRight;}
+    TComDataCU*   getCUAboveLeft() { return m_pcCUAboveLeft; }
 
-    TComDataCU*   getCUColocated(RefPicList eRefPicList) { return m_apcCUColocated[eRefPicList];}
+    TComDataCU*   getCUAboveRight() { return m_pcCUAboveRight; }
+
+    TComDataCU*   getCUColocated(RefPicList eRefPicList) { return m_apcCUColocated[eRefPicList]; }
 
     TComDataCU*   getPULeft(UInt& uiLPartUnitIdx,
                             UInt  uiCurrPartUnitIdx,
@@ -557,14 +536,8 @@ public:
     TComDataCU*   getQpMinCuAbove(UInt& aPartUnitIdx, UInt currAbsIdxInLCU);
     Char          getRefQP(UInt uiCurrAbsIdxInLCU);
 
-    TComDataCU*   getPUAboveRightAdi(UInt& uiARPartUnitIdx,
-                                     UInt  uiCurrPartUnitIdx,
-                                     UInt  uiPartUnitOffset = 1,
-                                     Bool  bEnforceSliceRestriction = true);
-    TComDataCU*   getPUBelowLeftAdi(UInt& uiBLPartUnitIdx,
-                                    UInt  uiCurrPartUnitIdx,
-                                    UInt  uiPartUnitOffset = 1,
-                                    Bool  bEnforceSliceRestriction = true);
+    TComDataCU*   getPUAboveRightAdi(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction = true);
+    TComDataCU*   getPUBelowLeftAdi(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction = true);
 
     Void          deriveLeftRightTopIdx(UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT);
     Void          deriveLeftBottomIdx(UInt uiPartIdx, UInt& ruiPartIdxLB);
@@ -573,12 +546,7 @@ public:
     Void          deriveLeftBottomIdxAdi(UInt& ruiPartIdxLB, UInt  uiPartOffset, UInt uiPartDepth);
 
     Bool          hasEqualMotion(UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx);
-    Void          getInterMergeCandidates(UInt         uiAbsPartIdx,
-                                          UInt         uiPUIdx,
-                                          TComMvField* pcMFieldNeighbours,
-                                          UChar*       puhInterDirNeighbours,
-                                          Int&         numValidMergeCand,
-                                          Int          mrgCandIdx = -1);
+    Void          getInterMergeCandidates(UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
     Void          deriveLeftRightTopIdxGeneral(UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT);
     Void          deriveLeftBottomIdxGeneral(UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB);
 
@@ -586,7 +554,7 @@ public:
     // member functions for modes
     // -------------------------------------------------------------------------------------------------------------------
 
-    Bool          isIntra(UInt uiPartIdx)  { return m_pePredMode[uiPartIdx] == MODE_INTRA;}
+    Bool          isIntra(UInt uiPartIdx)  { return m_pePredMode[uiPartIdx] == MODE_INTRA; }
 
     Bool          isSkipped(UInt uiPartIdx);                                                      ///< SKIP (no residual)
     Bool          isBipredRestriction(UInt puIdx);
@@ -610,23 +578,23 @@ public:
     UInt          getCtxSkipFlag(UInt uiAbsPartIdx);
     UInt          getCtxInterDir(UInt uiAbsPartIdx);
 
-    UInt          getSliceStartCU(UInt pos)                  { return m_sliceStartCU[pos - m_uiAbsIdxInLCU];}
+    UInt          getSliceStartCU(UInt pos)                  { return m_sliceStartCU[pos - m_uiAbsIdxInLCU]; }
 
-    UInt          getSliceSegmentStartCU(UInt pos)                  { return m_sliceSegmentStartCU[pos - m_uiAbsIdxInLCU];}
+    UInt          getSliceSegmentStartCU(UInt pos)                  { return m_sliceSegmentStartCU[pos - m_uiAbsIdxInLCU]; }
 
-    UInt&         getTotalBins()                            { return m_uiTotalBins;}
+    UInt&         getTotalBins()                            { return m_uiTotalBins; }
 
     // -------------------------------------------------------------------------------------------------------------------
     // member functions for RD cost storage
     // -------------------------------------------------------------------------------------------------------------------
 
-    Double&       getTotalCost()                  { return m_dTotalCost;}
+    Double&       getTotalCost()                  { return m_dTotalCost; }
 
-    UInt&         getTotalDistortion()            { return m_uiTotalDistortion;}
+    UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
 
-    UInt&         getTotalBits()                  { return m_uiTotalBits;}
+    UInt&         getTotalBits()                  { return m_uiTotalBits; }
 
-    UInt&         getTotalNumPart()               { return m_uiNumPartition;}
+    UInt&         getTotalNumPart()               { return m_uiNumPartition; }
 
     UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
 };
@@ -712,7 +680,7 @@ static inline Bool lessThanRow(Int addr,
     // addr / numUnitsPerRow < val
     return addr < val * numUnitsPerRow;
 }
-};
+}
 
 //! \}
 
--- a/source/Lib/TLibCommon/TComInterpolationFilter.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComInterpolationFilter.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -49,15 +49,16 @@ using namespace x265;
 
 //! \ingroup TLibCommon
 //! \{
+
 // ====================================================================================================================
 // Tables
 // ====================================================================================================================
 
 const Short TComInterpolationFilter::m_lumaFilter[4][NTAPS_LUMA] =
 {
-    {  0, 0,   0, 64,  0,   0, 0,  0 },
-    { -1, 4, -10, 58, 17,  -5, 1,  0 },
-    { -1, 4, -11, 40, 40, -11, 4, -1 },
+    {  0, 0,   0, 64,  0,   0, 0,  0 },
+    { -1, 4, -10, 58, 17,  -5, 1,  0 },
+    { -1, 4, -11, 40, 40, -11, 4, -1 },
     {  0, 1,  -5, 17, 58, -10, 4, -1 }
 };
 
@@ -90,15 +91,7 @@ const Short TComInterpolationFilter::m_c
  * \param isFirst    Flag indicating whether it is the first filtering operation
  * \param isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterCopy(Int        bitDepth,
-                                         const Pel *src,
-                                         Int        srcStride,
-                                         Short *    dst,
-                                         Int        dstStride,
-                                         Int        width,
-                                         Int        height,
-                                         Bool       isFirst,
-                                         Bool       isLast)
+Void TComInterpolationFilter::filterCopy(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast)
 {
     Int row, col;
 
@@ -145,9 +138,7 @@ Void TComInterpolationFilter::filterCopy
                 Short val = src[col];
                 val = (val + offset) >> shift;
                 if (val < minVal) val = minVal;
-
                 if (val > maxVal) val = maxVal;
-
                 dst[col] = val;
             }
 
@@ -174,124 +165,107 @@ Void TComInterpolationFilter::filterCopy
  * \param  coeff      Pointer to filter taps
  */
 template<Int N, Bool isVertical, Bool isFirst, Bool isLast>
-Void TComInterpolationFilter::filter(Int          bitDepth,
-                                     Pel const *  src,
-                                     Int          srcStride,
-                                     Short *      dst,
-                                     Int          dstStride,
-                                     Int          width,
-                                     Int          height,
-                                     Short const *coeff)
+Void TComInterpolationFilter::filter(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff)
 {
 #if ENABLE_PRIMITIVES
     if (!isVertical)
     {
         if (N == 8 && !isFirst && !isLast)
         {
-            primitives.filter[FILTER_H_8_0_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_H_8_0_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 8 && !isFirst && isLast)
         {
-            primitives.filter[FILTER_H_8_0_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_H_8_0_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 8 && isFirst && !isLast)
         {
-            primitives.filter[FILTER_H_8_1_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_H_8_1_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 8 && isFirst && isLast)
         {
-            primitives.filter[FILTER_H_8_1_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_H_8_1_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
-/*
         if (N == 4 && !isFirst && !isLast)
         {
-            primitives.filter[FILTER_H_4_0_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_H_4_0_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 4 && !isFirst && isLast)
         {
-            primitives.filter[FILTER_H_4_0_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_H_4_0_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 4 && isFirst && !isLast)
         {
-            primitives.filter[FILTER_H_4_1_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_H_4_1_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 4 && isFirst && isLast)
         {
-            primitives.filter[FILTER_H_4_1_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_H_4_1_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
-        }*/
+        }
     }
 
-   if (isVertical)
+    if (isVertical)
     {
         if (N == 8 && !isFirst && !isLast)
         {
-            primitives.filter[FILTER_V_8_0_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_V_8_0_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 8 && !isFirst && isLast)
         {
-            primitives.filter[FILTER_V_8_0_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_V_8_0_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 8 && isFirst && !isLast)
         {
-            primitives.filter[FILTER_V_8_1_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_V_8_1_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 8 && isFirst && isLast)
         {
-            primitives.filter[FILTER_V_8_1_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height,
-                                              bitDepth);
+            primitives.filter[FILTER_V_8_1_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
-
         if (N == 4 && !isFirst && !isLast)
         {
-            primitives.filter[FILTER_V_4_0_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_V_4_0_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 4 && !isFirst && isLast)
         {
-            primitives.filter[FILTER_V_4_0_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_V_4_0_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 4 && isFirst && !isLast)
         {
-            primitives.filter[FILTER_V_4_1_0]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_V_4_1_0]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
 
         if (N == 4 && isFirst && isLast)
         {
-            primitives.filter[FILTER_V_4_1_1]((const short*)coeff, (pixel*)src, srcStride, (pixel*)dst, dstStride, width, height, bitDepth);
+            primitives.filter[FILTER_V_4_1_1]((const short*)coeff, src, srcStride, dst, dstStride, width, height, bitDepth);
             return;
         }
     }
@@ -307,13 +281,11 @@ Void TComInterpolationFilter::filter(Int
         c[2] = coeff[2];
         c[3] = coeff[3];
     }
-
     if (N >= 6)
     {
         c[4] = coeff[4];
         c[5] = coeff[5];
     }
-
     if (N == 8)
     {
         c[6] = coeff[6];
@@ -355,13 +327,11 @@ Void TComInterpolationFilter::filter(Int
                 sum += src[col + 2 * cStride] * c[2];
                 sum += src[col + 3 * cStride] * c[3];
             }
-
             if (N >= 6)
             {
                 sum += src[col + 4 * cStride] * c[4];
                 sum += src[col + 5 * cStride] * c[5];
             }
-
             if (N == 8)
             {
                 sum += src[col + 6 * cStride] * c[6];
@@ -374,7 +344,6 @@ Void TComInterpolationFilter::filter(Int
                 val = (val < 0) ? 0 : val;
                 val = (val > maxVal) ? maxVal : val;
             }
-
             dst[col] = val;
         }
 
@@ -398,15 +367,7 @@ Void TComInterpolationFilter::filter(Int
  * \param  coeff      Pointer to filter taps
  */
 template<Int N>
-Void TComInterpolationFilter::filterHor(Int          bitDepth,
-                                        Pel *        src,
-                                        Int          srcStride,
-                                        Short *      dst,
-                                        Int          dstStride,
-                                        Int          width,
-                                        Int          height,
-                                        Bool         isLast,
-                                        Short const *coeff)
+Void TComInterpolationFilter::filterHor(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isLast, Short const *coeff)
 {
     if (isLast)
     {
@@ -434,16 +395,7 @@ Void TComInterpolationFilter::filterHor(
  * \param  coeff      Pointer to filter taps
  */
 template<Int N>
-Void TComInterpolationFilter::filterVer(Int          bitDepth,
-                                        Pel *        src,
-                                        Int          srcStride,
-                                        Short *      dst,
-                                        Int          dstStride,
-                                        Int          width,
-                                        Int          height,
-                                        Bool         isFirst,
-                                        Bool         isLast,
-                                        Short const *coeff)
+Void TComInterpolationFilter::filterVer(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff)
 {
     if (isFirst && isLast)
     {
@@ -479,14 +431,7 @@ Void TComInterpolationFilter::filterVer(
  * \param  frac       Fractional sample offset
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterHorLuma(Pel *  src,
-                                            Int    srcStride,
-                                            Short *dst,
-                                            Int    dstStride,
-                                            Int    width,
-                                            Int    height,
-                                            Int    frac,
-                                            Bool   isLast)
+Void TComInterpolationFilter::filterHorLuma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast)
 {
     assert(frac >= 0 && frac < 4);
 
@@ -513,15 +458,7 @@ Void TComInterpolationFilter::filterHorL
  * \param  isFirst    Flag indicating whether it is the first filtering operation
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterVerLuma(Pel *  src,
-                                            Int    srcStride,
-                                            Short *dst,
-                                            Int    dstStride,
-                                            Int    width,
-                                            Int    height,
-                                            Int    frac,
-                                            Bool   isFirst,
-                                            Bool   isLast)
+Void TComInterpolationFilter::filterVerLuma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast)
 {
     assert(frac >= 0 && frac < 4);
 
@@ -547,14 +484,7 @@ Void TComInterpolationFilter::filterVerL
  * \param  frac       Fractional sample offset
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterHorChroma(Pel *  src,
-                                              Int    srcStride,
-                                              Short *dst,
-                                              Int    dstStride,
-                                              Int    width,
-                                              Int    height,
-                                              Int    frac,
-                                              Bool   isLast)
+Void TComInterpolationFilter::filterHorChroma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast)
 {
     assert(frac >= 0 && frac < 8);
 
@@ -581,15 +511,7 @@ Void TComInterpolationFilter::filterHorC
  * \param  isFirst    Flag indicating whether it is the first filtering operation
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterVerChroma(Pel *  src,
-                                              Int    srcStride,
-                                              Short *dst,
-                                              Int    dstStride,
-                                              Int    width,
-                                              Int    height,
-                                              Int    frac,
-                                              Bool   isFirst,
-                                              Bool   isLast)
+Void TComInterpolationFilter::filterVerChroma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast)
 {
     assert(frac >= 0 && frac < 8);
 
--- a/source/Lib/TLibCommon/TComInterpolationFilter.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComInterpolationFilter.h	Tue Apr 23 11:07:40 2013 +0530
@@ -58,47 +58,15 @@ class TComInterpolationFilter
     static const Short m_lumaFilter[4][NTAPS_LUMA];   ///< Luma filter taps
     static const Short m_chromaFilter[8][NTAPS_CHROMA]; ///< Chroma filter taps
 
-    static Void filterCopy(Int        bitDepth,
-                           const Pel *src,
-                           Int        srcStride,
-                           Short *    dst,
-                           Int        dstStride,
-                           Int        width,
-                           Int        height,
-                           Bool       isFirst,
-                           Bool       isLast);
+    static Void filterCopy(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast);
 
     template<Int N, Bool isVertical, Bool isFirst, Bool isLast>
-    static Void filter(Int          bitDepth,
-                       Pel const *  src,
-                       Int          srcStride,
-                       Short *      dst,
-                       Int          dstStride,
-                       Int          width,
-                       Int          height,
-                       Short const *coeff);
+    static Void filter(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff);
 
     template<Int N>
-    static Void filterHor(Int          bitDepth,
-                          Pel *        src,
-                          Int          srcStride,
-                          Short *      dst,
-                          Int          dstStride,
-                          Int          width,
-                          Int          height,
-                          Bool         isLast,
-                          Short const *coeff);
+    static Void filterHor(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height,               Bool isLast, Short const *coeff);
     template<Int N>
-    static Void filterVer(Int          bitDepth,
-                          Pel *        src,
-                          Int          srcStride,
-                          Short *      dst,
-                          Int          dstStride,
-                          Int          width,
-                          Int          height,
-                          Bool         isFirst,
-                          Bool         isLast,
-                          Short const *coeff);
+    static Void filterVer(Int bitDepth, Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff);
 
 public:
 
@@ -106,40 +74,10 @@ public:
 
     ~TComInterpolationFilter() {}
 
-    Void filterHorLuma(Pel *  src,
-                       Int    srcStride,
-                       Short *dst,
-                       Int    dstStride,
-                       Int    width,
-                       Int    height,
-                       Int    frac,
-                       Bool   isLast);
-    Void filterVerLuma(Pel *  src,
-                       Int    srcStride,
-                       Short *dst,
-                       Int    dstStride,
-                       Int    width,
-                       Int    height,
-                       Int    frac,
-                       Bool   isFirst,
-                       Bool   isLast);
-    Void filterHorChroma(Pel *  src,
-                         Int    srcStride,
-                         Short *dst,
-                         Int    dstStride,
-                         Int    width,
-                         Int    height,
-                         Int    frac,
-                         Bool   isLast);
-    Void filterVerChroma(Pel *  src,
-                         Int    srcStride,
-                         Short *dst,
-                         Int    dstStride,
-                         Int    width,
-                         Int    height,
-                         Int    frac,
-                         Bool   isFirst,
-                         Bool   isLast);
+    Void filterHorLuma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast);
+    Void filterVerLuma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast);
+    Void filterHorChroma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast);
+    Void filterVerChroma(Short *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast);
 };
 
 //! \}
--- a/source/Lib/TLibCommon/TComList.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComList.h	Tue Apr 23 11:07:40 2013 +0530
@@ -70,7 +70,6 @@ public:
         {
             insert(this->end(), rcTComList.begin(), rcTComList.end());
         }
-
         return *this;
     } // leszek
 
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -58,14 +58,12 @@
 
 const UChar TComLoopFilter::sm_tcTable[54] =
 {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6,
-    7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24
 };
 
 const UChar TComLoopFilter::sm_betaTable[52] =
 {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32,
-    34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64
 };
 
 // ====================================================================================================================
@@ -111,13 +109,12 @@ Void TComLoopFilter::destroy()
     {
         if (m_aapucBS)
         {
-            delete[] m_aapucBS[uiDir];
+            delete [] m_aapucBS[uiDir];
             m_aapucBS[uiDir] = NULL;
         }
-
         if (m_aapbEdgeFilter[uiDir])
         {
-            delete[] m_aapbEdgeFilter[uiDir];
+            delete [] m_aapbEdgeFilter[uiDir];
             m_aapbEdgeFilter[uiDir] = NULL;
         }
     }
@@ -170,7 +167,6 @@ Void TComLoopFilter::xDeblockCU(TComData
     {
         return;
     }
-
     TComPic* pcPic     = pcCU->getPic();
     UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth << 1);
     UInt uiQNumParts   = uiCurNumParts >> 2;
@@ -181,8 +177,7 @@ Void TComLoopFilter::xDeblockCU(TComData
         {
             UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiAbsZorderIdx]];
             UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiAbsZorderIdx]];
-            if ((uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples()) &&
-                (uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()))
+            if ((uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples()) && (uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()))
             {
                 xDeblockCU(pcCU, uiAbsZorderIdx, uiDepth + 1, Edge);
             }
@@ -202,8 +197,7 @@ Void TComLoopFilter::xDeblockCU(TComData
         UInt uiBSCheck;
         if ((g_uiMaxCUWidth >> g_uiMaxCUDepth) == 4)
         {
-            uiBSCheck =
-                (iDir == EDGE_VER && uiPartIdx % 2 == 0) || (iDir == EDGE_HOR && (uiPartIdx - ((uiPartIdx >> 2) << 2)) / 2 == 0);
+            uiBSCheck = (iDir == EDGE_VER && uiPartIdx % 2 == 0) || (iDir == EDGE_HOR && (uiPartIdx - ((uiPartIdx >> 2) << 2)) / 2 == 0);
         }
         else
         {
@@ -231,25 +225,16 @@ Void TComLoopFilter::xDeblockCU(TComData
     }
 }
 
-Void TComLoopFilter::xSetEdgefilterMultiple(TComDataCU* pcCU,
-                                            UInt        uiScanIdx,
-                                            UInt        uiDepth,
-                                            Int         iDir,
-                                            Int         iEdgeIdx,
-                                            Bool        bValue,
-                                            UInt        uiWidthInBaseUnits,
-                                            UInt        uiHeightInBaseUnits)
+Void TComLoopFilter::xSetEdgefilterMultiple(TComDataCU* pcCU, UInt uiScanIdx, UInt uiDepth, Int iDir, Int iEdgeIdx, Bool bValue, UInt uiWidthInBaseUnits, UInt uiHeightInBaseUnits)
 {
     if (uiWidthInBaseUnits == 0)
     {
         uiWidthInBaseUnits  = pcCU->getPic()->getNumPartInWidth() >> uiDepth;
     }
-
     if (uiHeightInBaseUnits == 0)
     {
         uiHeightInBaseUnits = pcCU->getPic()->getNumPartInHeight() >> uiDepth;
     }
-
     const UInt uiNumElem = iDir == 0 ? uiHeightInBaseUnits : uiWidthInBaseUnits;
     assert(uiNumElem > 0);
     assert(uiWidthInBaseUnits > 0);
@@ -286,22 +271,8 @@ Void TComLoopFilter::xSetEdgefilterTU(TC
     UInt uiWidthInBaseUnits  = trWidth / (g_uiMaxCUWidth >> g_uiMaxCUDepth);
     UInt uiHeightInBaseUnits = trHeight / (g_uiMaxCUWidth >> g_uiMaxCUDepth);
 
-    xSetEdgefilterMultiple(pcCU,
-                           absTUPartIdx,
-                           uiDepth,
-                           EDGE_VER,
-                           0,
-                           m_stLFCUParam.bInternalEdge,
-                           uiWidthInBaseUnits,
-                           uiHeightInBaseUnits);
-    xSetEdgefilterMultiple(pcCU,
-                           absTUPartIdx,
-                           uiDepth,
-                           EDGE_HOR,
-                           0,
-                           m_stLFCUParam.bInternalEdge,
-                           uiWidthInBaseUnits,
-                           uiHeightInBaseUnits);
+    xSetEdgefilterMultiple(pcCU, absTUPartIdx, uiDepth, EDGE_VER, 0, m_stLFCUParam.bInternalEdge, uiWidthInBaseUnits, uiHeightInBaseUnits);
+    xSetEdgefilterMultiple(pcCU, absTUPartIdx, uiDepth, EDGE_HOR, 0, m_stLFCUParam.bInternalEdge, uiWidthInBaseUnits, uiHeightInBaseUnits);
 }
 
 Void TComLoopFilter::xSetEdgefilterPU(TComDataCU* pcCU, UInt uiAbsZorderIdx)
@@ -346,12 +317,7 @@ Void TComLoopFilter::xSetEdgefilterPU(TC
     }
     case SIZE_2NxnD:
     {
-        xSetEdgefilterMultiple(pcCU,
-                               uiAbsZorderIdx,
-                               uiDepth,
-                               EDGE_HOR,
-                               uiHeightInBaseUnits - uiQHeightInBaseUnits,
-                               m_stLFCUParam.bInternalEdge);
+        xSetEdgefilterMultiple(pcCU, uiAbsZorderIdx, uiDepth, EDGE_HOR, uiHeightInBaseUnits - uiQHeightInBaseUnits, m_stLFCUParam.bInternalEdge);
         break;
     }
     case SIZE_nLx2N:
@@ -361,12 +327,7 @@ Void TComLoopFilter::xSetEdgefilterPU(TC
     }
     case SIZE_nRx2N:
     {
-        xSetEdgefilterMultiple(pcCU,
-                               uiAbsZorderIdx,
-                               uiDepth,
-                               EDGE_VER,
-                               uiWidthInBaseUnits - uiQWidthInBaseUnits,
-                               m_stLFCUParam.bInternalEdge);
+        xSetEdgefilterMultiple(pcCU, uiAbsZorderIdx, uiDepth, EDGE_VER, uiWidthInBaseUnits - uiQWidthInBaseUnits, m_stLFCUParam.bInternalEdge);
         break;
     }
     default:
@@ -394,11 +355,9 @@ Void TComLoopFilter::xSetLoopfilterParam
     {
         m_stLFCUParam.bLeftEdge = true;
     }
-
     if (m_stLFCUParam.bLeftEdge)
     {
-        pcTempCU = pcCU->getPULeft(uiTempPartIdx, uiAbsZorderIdx,
-                                   !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
+        pcTempCU = pcCU->getPULeft(uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
         if (pcTempCU)
         {
             m_stLFCUParam.bLeftEdge = true;
@@ -417,11 +376,9 @@ Void TComLoopFilter::xSetLoopfilterParam
     {
         m_stLFCUParam.bTopEdge = true;
     }
-
     if (m_stLFCUParam.bTopEdge)
     {
-        pcTempCU = pcCU->getPUAbove(uiTempPartIdx, uiAbsZorderIdx,
-                                    !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
+        pcTempCU = pcCU->getPUAbove(uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
 
         if (pcTempCU)
         {
@@ -452,8 +409,7 @@ Void TComLoopFilter::xGetBoundaryStrengt
     }
     else // (iDir == EDGE_HOR)
     {
-        pcCUP = pcCUQ->getPUAbove(uiPartP, uiPartQ,
-                                  !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
+        pcCUP = pcCUQ->getPUAbove(uiPartP, uiPartQ, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
     }
 
     //-- Set BS for Intra MB : BS = 4 or 3
@@ -468,10 +424,7 @@ Void TComLoopFilter::xGetBoundaryStrengt
         UInt nsPartQ = uiPartQ;
         UInt nsPartP = uiPartP;
 
-        if (m_aapucBS[iDir][uiAbsPartIdx] &&
-            (pcCUQ->getCbf(nsPartQ, TEXT_LUMA,
-                           pcCUQ->getTransformIdx(nsPartQ)) != 0 ||
-             pcCUP->getCbf(nsPartP, TEXT_LUMA, pcCUP->getTransformIdx(nsPartP)) != 0))
+        if (m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf(nsPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(nsPartQ)) != 0 || pcCUP->getCbf(nsPartP, TEXT_LUMA, pcCUP->getTransformIdx(nsPartP)) != 0))
         {
             uiBs = 1;
         }
@@ -479,10 +432,8 @@ Void TComLoopFilter::xGetBoundaryStrengt
         {
             if (iDir == EDGE_HOR)
             {
-                pcCUP = pcCUQ->getPUAbove(uiPartP, uiPartQ,
-                                          !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
+                pcCUP = pcCUQ->getPUAbove(uiPartP, uiPartQ, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
             }
-
             if (pcSlice->isInterB() || pcCUP->getSlice()->isInterB())
             {
                 Int iRefIdx;
@@ -502,11 +453,8 @@ Void TComLoopFilter::xGetBoundaryStrengt
                 TComMv pcMvQ1 = pcCUQ->getCUMvField(REF_PIC_LIST_1)->getMv(uiPartQ);
 
                 if (piRefP0 == NULL) pcMvP0.setZero();
-
                 if (piRefP1 == NULL) pcMvP1.setZero();
-
                 if (piRefQ0 == NULL) pcMvQ0.setZero();
-
                 if (piRefQ1 == NULL) pcMvQ1.setZero();
 
                 if (((piRefP0 == piRefQ0) && (piRefP1 == piRefQ1)) || ((piRefP0 == piRefQ1) && (piRefP1 == piRefQ0)))
@@ -558,7 +506,6 @@ Void TComLoopFilter::xGetBoundaryStrengt
                 TComMv pcMvQ0 = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartQ);
 
                 if (piRefP0 == NULL) pcMvP0.setZero();
-
                 if (piRefQ0 == NULL) pcMvQ0.setZero();
 
                 uiBs  = ((piRefP0 != piRefQ0) ||
@@ -587,8 +534,7 @@ Void TComLoopFilter::xEdgeFilterLuma(TCo
     UInt  uiBsAbsIdx = 0, uiBs = 0;
     Int   iOffset, iSrcStep;
 
-    Bool  bPCMFilter =
-        (pcCU->getSlice()->getSPS()->getUsePCM() && pcCU->getSlice()->getSPS()->getPCMFilterDisableFlag()) ? true : false;
+    Bool  bPCMFilter = (pcCU->getSlice()->getSPS()->getUsePCM() && pcCU->getSlice()->getSPS()->getPCMFilterDisableFlag()) ? true : false;
     Bool  bPartPNoFilter = false;
     Bool  bPartQNoFilter = false;
     UInt  uiPartPIdx = 0;
@@ -622,21 +568,18 @@ Void TComLoopFilter::xEdgeFilterLuma(TCo
             // Derive neighboring PU index
             if (iDir == EDGE_VER)
             {
-                pcCUP = pcCUQ->getPULeft(uiPartPIdx, uiPartQIdx,
-                                         !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
+                pcCUP = pcCUQ->getPULeft(uiPartPIdx, uiPartQIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
             }
             else // (iDir == EDGE_HOR)
             {
-                pcCUP = pcCUQ->getPUAbove(uiPartPIdx, uiPartQIdx,
-                                          !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
+                pcCUP = pcCUQ->getPUAbove(uiPartPIdx, uiPartQIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
             }
 
             iQP_P = pcCUP->getQP(uiPartPIdx);
             iQP = (iQP_P + iQP_Q + 1) >> 1;
             Int iBitdepthScale = 1 << (g_bitDepthY - 8);
 
-            Int iIndexTC =
-                Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, Int(iQP + DEFAULT_INTRA_TC_OFFSET * (uiBs - 1) + (tcOffsetDiv2 << 1)));
+            Int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, Int(iQP + DEFAULT_INTRA_TC_OFFSET * (uiBs - 1) + (tcOffsetDiv2 << 1)));
             Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1));
 
             Int iTc =  sm_tcTable[iIndexTC] * iBitdepthScale;
@@ -674,23 +617,12 @@ Void TComLoopFilter::xEdgeFilterLuma(TCo
                     Bool bFilterP = (dp < iSideThreshold);
                     Bool bFilterQ = (dq < iSideThreshold);
 
-                    Bool sw =
-                        xUseStrongFiltering(iOffset, 2 * d0, iBeta, iTc, piTmpSrc + iSrcStep *
-                                            (iIdx * uiPelsInPart + iBlkIdx * 4 + 0))
-                        && xUseStrongFiltering(iOffset, 2 * d3, iBeta, iTc, piTmpSrc + iSrcStep *
-                                               (iIdx * uiPelsInPart + iBlkIdx * 4 + 3));
+                    Bool sw =  xUseStrongFiltering(iOffset, 2 * d0, iBeta, iTc, piTmpSrc + iSrcStep * (iIdx * uiPelsInPart + iBlkIdx * 4 + 0))
+                        && xUseStrongFiltering(iOffset, 2 * d3, iBeta, iTc, piTmpSrc + iSrcStep * (iIdx * uiPelsInPart + iBlkIdx * 4 + 3));
 
                     for (Int i = 0; i < DEBLOCK_SMALLEST_BLOCK / 2; i++)
                     {
-                        xPelFilterLuma(piTmpSrc + iSrcStep * (iIdx * uiPelsInPart + iBlkIdx * 4 + i),
-                                       iOffset,
-                                       iTc,
-                                       sw,
-                                       bPartPNoFilter,
-                                       bPartQNoFilter,
-                                       iThrCut,
-                                       bFilterP,
-                                       bFilterQ);
+                        xPelFilterLuma(piTmpSrc + iSrcStep * (iIdx * uiPelsInPart + iBlkIdx * 4 + i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
                     }
                 }
             }
@@ -714,8 +646,7 @@ Void TComLoopFilter::xEdgeFilterChroma(T
 
     const UInt uiLCUWidthInBaseUnits = pcCU->getPic()->getNumPartInWidth();
 
-    Bool  bPCMFilter =
-        (pcCU->getSlice()->getSPS()->getUsePCM() && pcCU->getSlice()->getSPS()->getPCMFilterDisableFlag()) ? true : false;
+    Bool  bPCMFilter = (pcCU->getSlice()->getSPS()->getUsePCM() && pcCU->getSlice()->getSPS()->getPCMFilterDisableFlag()) ? true : false;
     Bool  bPartPNoFilter = false;
     Bool  bPartQNoFilter = false;
     UInt  uiPartPIdx;
@@ -728,9 +659,7 @@ Void TComLoopFilter::xEdgeFilterChroma(T
     UInt uiEdgeNumInLCUVert = g_auiZscanToRaster[uiAbsZorderIdx] % uiLCUWidthInBaseUnits + iEdge;
     UInt uiEdgeNumInLCUHor = g_auiZscanToRaster[uiAbsZorderIdx] / uiLCUWidthInBaseUnits + iEdge;
 
-    if ((uiPelsInPartChroma < DEBLOCK_SMALLEST_BLOCK) &&
-        (((uiEdgeNumInLCUVert % (DEBLOCK_SMALLEST_BLOCK / uiPelsInPartChroma)) &&
-          (iDir == 0)) || ((uiEdgeNumInLCUHor % (DEBLOCK_SMALLEST_BLOCK / uiPelsInPartChroma)) && iDir)))
+    if ((uiPelsInPartChroma < DEBLOCK_SMALLEST_BLOCK) && (((uiEdgeNumInLCUVert % (DEBLOCK_SMALLEST_BLOCK / uiPelsInPartChroma)) && (iDir == 0)) || ((uiEdgeNumInLCUHor % (DEBLOCK_SMALLEST_BLOCK / uiPelsInPartChroma)) && iDir)))
     {
         return;
     }
@@ -772,13 +701,11 @@ Void TComLoopFilter::xEdgeFilterChroma(T
             // Derive neighboring PU index
             if (iDir == EDGE_VER)
             {
-                pcCUP = pcCUQ->getPULeft(uiPartPIdx, uiPartQIdx,
-                                         !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
+                pcCUP = pcCUQ->getPULeft(uiPartPIdx, uiPartQIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
             }
             else // (iDir == EDGE_HOR)
             {
-                pcCUP = pcCUQ->getPUAbove(uiPartPIdx, uiPartQIdx,
-                                          !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
+                pcCUP = pcCUQ->getPUAbove(uiPartPIdx, uiPartQIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
             }
 
             iQP_P = pcCUP->getQP(uiPartPIdx);
@@ -796,25 +723,18 @@ Void TComLoopFilter::xEdgeFilterChroma(T
 
             for (UInt chromaIdx = 0; chromaIdx < 2; chromaIdx++)
             {
-                Int chromaQPOffset  =
-                    (chromaIdx ==
-                     0) ? pcCU->getSlice()->getPPS()->getChromaCbQpOffset() : pcCU->getSlice()->getPPS()->getChromaCrQpOffset();
+                Int chromaQPOffset  = (chromaIdx == 0) ? pcCU->getSlice()->getPPS()->getChromaCbQpOffset() : pcCU->getSlice()->getPPS()->getChromaCrQpOffset();
                 Pel* piTmpSrcChroma = (chromaIdx == 0) ? piTmpSrcCb : piTmpSrcCr;
 
                 iQP = QpUV(((iQP_P + iQP_Q + 1) >> 1) + chromaQPOffset);
                 Int iBitdepthScale = 1 << (g_bitDepthC - 8);
 
-                Int iIndexTC =
-                    Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (ucBs - 1) + (tcOffsetDiv2 << 1));
+                Int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (ucBs - 1) + (tcOffsetDiv2 << 1));
                 Int iTc =  sm_tcTable[iIndexTC] * iBitdepthScale;
 
                 for (UInt uiStep = 0; uiStep < uiPelsInPartChroma; uiStep++)
                 {
-                    xPelFilterChroma(piTmpSrcChroma + iSrcStep * (uiStep + iIdx * uiPelsInPartChroma),
-                                     iOffset,
-                                     iTc,
-                                     bPartPNoFilter,
-                                     bPartQNoFilter);
+                    xPelFilterChroma(piTmpSrcChroma + iSrcStep * (uiStep + iIdx * uiPelsInPartChroma), iOffset, iTc, bPartPNoFilter, bPartQNoFilter);
                 }
             }
         }
@@ -834,15 +754,7 @@ Void TComLoopFilter::xEdgeFilterChroma(T
  \param bFilterSecondP  decision weak filter/no filter for partP
  \param bFilterSecondQ  decision weak filter/no filter for partQ
 */
-__inline Void TComLoopFilter::xPelFilterLuma(Pel* piSrc,
-                                             Int  iOffset,
-                                             Int  tc,
-                                             Bool sw,
-                                             Bool bPartPNoFilter,
-                                             Bool bPartQNoFilter,
-                                             Int  iThrCut,
-                                             Bool bFilterSecondP,
-                                             Bool bFilterSecondQ)
+__inline Void TComLoopFilter::xPelFilterLuma(Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ)
 {
     Int delta;
 
@@ -881,7 +793,6 @@ Void TComLoopFilter::xEdgeFilterChroma(T
                 Int delta1 = Clip3(-tc2, tc2, ((((m1 + m3 + 1) >> 1) - m2 + delta) >> 1));
                 piSrc[-iOffset * 2] = ClipY((m2 + delta1));
             }
-
             if (bFilterSecondQ)
             {
                 Int delta2 = Clip3(-tc2, tc2, ((((m6 + m4 + 1) >> 1) - m5 - delta) >> 1));
@@ -896,7 +807,6 @@ Void TComLoopFilter::xEdgeFilterChroma(T
         piSrc[-iOffset * 2] = m2;
         piSrc[-iOffset * 3] = m1;
     }
-
     if (bPartQNoFilter)
     {
         piSrc[0] = m4;
@@ -931,7 +841,6 @@ Void TComLoopFilter::xEdgeFilterChroma(T
     {
         piSrc[-iOffset] = m3;
     }
-
     if (bPartQNoFilter)
     {
         piSrc[0] = m4;
--- a/source/Lib/TLibCommon/TComLoopFilter.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComLoopFilter.h	Tue Apr 23 11:07:40 2013 +0530
@@ -88,27 +88,12 @@ protected:
         }
     }
 
-    Void xSetEdgefilterMultiple(TComDataCU* pcCU,
-                                UInt        uiAbsZorderIdx,
-                                UInt        uiDepth,
-                                Int         iDir,
-                                Int         iEdgeIdx,
-                                Bool        bValue,
-                                UInt        uiWidthInBaseUnits = 0,
-                                UInt        uiHeightInBaseUnits = 0);
+    Void xSetEdgefilterMultiple(TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdgeIdx, Bool bValue, UInt uiWidthInBaseUnits = 0, UInt uiHeightInBaseUnits = 0);
 
     Void xEdgeFilterLuma(TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge);
     Void xEdgeFilterChroma(TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge);
 
-    __inline Void xPelFilterLuma(Pel* piSrc,
-                                 Int  iOffset,
-                                 Int  tc,
-                                 Bool sw,
-                                 Bool bPartPNoFilter,
-                                 Bool bPartQNoFilter,
-                                 Int  iThrCut,
-                                 Bool bFilterSecondP,
-                                 Bool bFilterSecondQ);
+    __inline Void xPelFilterLuma(Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ);
     __inline Void xPelFilterChroma(Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter);
 
     __inline Bool xUseStrongFiltering(Int offset, Int d, Int beta, Int tc, Pel* piSrc);
--- a/source/Lib/TLibCommon/TComMotionInfo.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComMotionInfo.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -197,7 +197,6 @@ Void TComCUMvField::setAll(T *p, T const
                 pT[i] = val;
             }
         }
-
         break;
     }
     case SIZE_2NxnD:
@@ -227,7 +226,6 @@ Void TComCUMvField::setAll(T *p, T const
                 pT2[i] = val;
             }
         }
-
         break;
     }
     case SIZE_nLx2N:
@@ -266,7 +264,6 @@ Void TComCUMvField::setAll(T *p, T const
                 pT2[i] = val;
             }
         }
-
         break;
     }
     case SIZE_nRx2N:
@@ -304,7 +301,6 @@ Void TComCUMvField::setAll(T *p, T const
                 pT4[i] = val;
             }
         }
-
         break;
     }
     default:
--- a/source/Lib/TLibCommon/TComMotionInfo.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComMotionInfo.h	Tue Apr 23 11:07:40 2013 +0530
@@ -79,17 +79,17 @@ public:
         m_iRefIdx = iRefIdx;
     }
 
-    Void setRefIdx(Int refIdx) { m_iRefIdx = refIdx;}
-
-    TComMv const & getMv() const { return m_acMv;}
+    Void setRefIdx(Int refIdx) { m_iRefIdx = refIdx; }
 
-    TComMv       & getMv()       { return m_acMv;}
+    TComMv const & getMv() const { return m_acMv; }
 
-    Int getRefIdx() const { return m_iRefIdx;}
+    TComMv       & getMv()       { return m_acMv; }
 
-    Int getHor() const { return m_acMv.getHor();}
+    Int getRefIdx() const { return m_iRefIdx;       }
 
-    Int getVer() const { return m_acMv.getVer();}
+    Int getHor() const { return m_acMv.getHor(); }
+
+    Int getVer() const { return m_acMv.getVer(); }
 };
 
 /// class for motion information in one CU
@@ -133,13 +133,13 @@ public:
     // get
     // ------------------------------------------------------------------------------------------------------------------
 
-    TComMv const & getMv(Int iIdx) const { return m_pcMv[iIdx];}
+    TComMv const & getMv(Int iIdx) const { return m_pcMv[iIdx]; }
 
-    TComMv const & getMvd(Int iIdx) const { return m_pcMvd[iIdx];}
+    TComMv const & getMvd(Int iIdx) const { return m_pcMvd[iIdx]; }
 
-    Int            getRefIdx(Int iIdx) const { return m_piRefIdx[iIdx];}
+    Int            getRefIdx(Int iIdx) const { return m_piRefIdx[iIdx]; }
 
-    AMVPInfo* getAMVPInfo() { return &m_cAMVPInfo;}
+    AMVPInfo* getAMVPInfo() { return &m_cAMVPInfo; }
 
     // ------------------------------------------------------------------------------------------------------------------
     // set
--- a/source/Lib/TLibCommon/TComMv.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComMv.h	Tue Apr 23 11:07:40 2013 +0530
@@ -75,25 +75,25 @@ public:
     // set
     // ------------------------------------------------------------------------------------------------------------------
 
-    Void  set(Short iHor, Short iVer)     { m_iHor = iHor;m_iVer = iVer;}
+    Void  set(Short iHor, Short iVer)     { m_iHor = iHor;  m_iVer = iVer;            }
 
-    Void  setHor(Short i)                   { m_iHor = i;}
+    Void  setHor(Short i)                   { m_iHor = i;                               }
 
-    Void  setVer(Short i)                   { m_iVer = i;}
+    Void  setVer(Short i)                   { m_iVer = i;                               }
 
-    Void  setZero()                            { m_iHor = m_iVer = 0;}
+    Void  setZero()                            { m_iHor = m_iVer = 0;  }
 
     // ------------------------------------------------------------------------------------------------------------------
     // get
     // ------------------------------------------------------------------------------------------------------------------
 
-    Int   getHor() const { return m_iHor;}
+    Int   getHor() const { return m_iHor;          }
 
-    Int   getVer() const { return m_iVer;}
+    Int   getVer() const { return m_iVer;          }
 
-    Int   getAbsHor() const { return abs(m_iHor);}
+    Int   getAbsHor() const { return abs(m_iHor);   }
 
-    Int   getAbsVer() const { return abs(m_iVer);}
+    Int   getAbsVer() const { return abs(m_iVer);   }
 
     // ------------------------------------------------------------------------------------------------------------------
     // operations
--- a/source/Lib/TLibCommon/TComPattern.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -110,24 +110,18 @@ Void TComPatternParam::setPatternParamCU
     if (iComp == 0)
     {
         m_iPatternStride  = pcCU->getPic()->getStride();
-        m_piPatternOrigin =
-            pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(),
-                                                        uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
+        m_piPatternOrigin = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
     }
     else
     {
         m_iPatternStride = pcCU->getPic()->getCStride();
         if (iComp == 1)
         {
-            m_piPatternOrigin =
-                pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(),
-                                                          uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
+            m_piPatternOrigin = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
         }
         else
         {
-            m_piPatternOrigin =
-                pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(),
-                                                          uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
+            m_piPatternOrigin = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
         }
     }
 }
@@ -177,15 +171,7 @@ Void TComPattern::initPattern(TComDataCU
     m_cPatternCr.setPatternParamCU(pcCU, 2, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetAbove, uiAbsPartIdx);
 }
 
-Void TComPattern::initAdiPattern(TComDataCU* pcCU,
-                                 UInt        uiZorderIdxInPart,
-                                 UInt        uiPartDepth,
-                                 Int*        piAdiBuf,
-                                 Int         iOrgBufStride,
-                                 Int         iOrgBufHeight,
-                                 Bool&       bAbove,
-                                 Bool&       bLeft,
-                                 Bool        bLMmode)
+Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft, Bool bLMmode)
 {
     Pel*  piRoiOrigin;
     Int*  piAdiTemp;
@@ -232,20 +218,7 @@ Void TComPattern::initAdiPattern(TComDat
     piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiZorderIdxInPart);
     piAdiTemp   = piAdiBuf;
 
-    fillReferenceSamples(g_bitDepthY,
-                         piRoiOrigin,
-                         piAdiTemp,
-                         bNeighborFlags,
-                         iNumIntraNeighbor,
-                         iUnitSize,
-                         iNumUnitsInCu,
-                         iTotalUnits,
-                         uiCuWidth,
-                         uiCuHeight,
-                         uiWidth,
-                         uiHeight,
-                         iPicStride,
-                         bLMmode);
+    fillReferenceSamples(g_bitDepthY, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, bLMmode);
 
     Int   i;
     // generate filtered intra prediction samples
@@ -335,14 +308,7 @@ Void TComPattern::initAdiPattern(TComDat
     }
 }
 
-Void TComPattern::initAdiPatternChroma(TComDataCU* pcCU,
-                                       UInt        uiZorderIdxInPart,
-                                       UInt        uiPartDepth,
-                                       Int*        piAdiBuf,
-                                       Int         iOrgBufStride,
-                                       Int         iOrgBufHeight,
-                                       Bool&       bAbove,
-                                       Bool&       bLeft)
+Void TComPattern::initAdiPatternChroma(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft)
 {
     Pel*  piRoiOrigin;
     Int*  piAdiTemp;
@@ -392,53 +358,16 @@ Void TComPattern::initAdiPatternChroma(T
     piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiZorderIdxInPart);
     piAdiTemp   = piAdiBuf;
 
-    fillReferenceSamples(g_bitDepthC,
-                         piRoiOrigin,
-                         piAdiTemp,
-                         bNeighborFlags,
-                         iNumIntraNeighbor,
-                         iUnitSize,
-                         iNumUnitsInCu,
-                         iTotalUnits,
-                         uiCuWidth,
-                         uiCuHeight,
-                         uiWidth,
-                         uiHeight,
-                         iPicStride);
+    fillReferenceSamples(g_bitDepthC, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride);
 
     // get Cr pattern
     piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiZorderIdxInPart);
     piAdiTemp   = piAdiBuf + uiWidth * uiHeight;
 
-    fillReferenceSamples(g_bitDepthC,
-                         piRoiOrigin,
-                         piAdiTemp,
-                         bNeighborFlags,
-                         iNumIntraNeighbor,
-                         iUnitSize,
-                         iNumUnitsInCu,
-                         iTotalUnits,
-                         uiCuWidth,
-                         uiCuHeight,
-                         uiWidth,
-                         uiHeight,
-                         iPicStride);
+    fillReferenceSamples(g_bitDepthC, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride);
 }
 
-Void TComPattern::fillReferenceSamples(Int   bitDepth,
-                                       Pel*  piRoiOrigin,
-                                       Int*  piAdiTemp,
-                                       Bool* bNeighborFlags,
-                                       Int   iNumIntraNeighbor,
-                                       Int   iUnitSize,
-                                       Int   iNumUnitsInCu,
-                                       Int   iTotalUnits,
-                                       UInt  uiCuWidth,
-                                       UInt  uiCuHeight,
-                                       UInt  uiWidth,
-                                       UInt  uiHeight,
-                                       Int   iPicStride,
-                                       Bool  bLMmode)
+Void TComPattern::fillReferenceSamples(Int bitDepth, Pel* piRoiOrigin, Int* piAdiTemp, Bool* bNeighborFlags, Int iNumIntraNeighbor, Int iUnitSize, Int iNumUnitsInCu, Int iTotalUnits, UInt uiCuWidth, UInt uiCuHeight, UInt uiWidth, UInt uiHeight, Int iPicStride, Bool bLMmode)
 {
     Pel* piRoiTemp;
     Int  i, j;
@@ -533,7 +462,6 @@ Void TComPattern::fillReferenceSamples(I
         {
             piRoiTemp--; // move the second left column
         }
-
         piAdiLineTemp--;
         pbNeighborFlags--;
         for (j = 0; j < iNumUnits2; j++)
@@ -545,7 +473,6 @@ Void TComPattern::fillReferenceSamples(I
                     piAdiLineTemp[-i] = piRoiTemp[i * iPicStride];
                 }
             }
-
             piRoiTemp += iUnitSize * iPicStride;
             piAdiLineTemp -= iUnitSize;
             pbNeighborFlags--;
@@ -564,7 +491,6 @@ Void TComPattern::fillReferenceSamples(I
                     piAdiLineTemp[i] = piRoiTemp[i];
                 }
             }
-
             piRoiTemp += iUnitSize;
             piAdiLineTemp += iUnitSize;
             pbNeighborFlags++;
@@ -696,7 +622,6 @@ Bool TComPattern::isAboveLeftAvailable(T
     {
         bAboveLeftFlag = (pcCUAboveLeft ? true : false);
     }
-
     return bAboveLeftFlag;
 }
 
@@ -736,7 +661,6 @@ Int TComPattern::isAboveAvailable(TComDa
                 *pbValidFlags = false;
             }
         }
-
         pbValidFlags++;
     }
 
@@ -779,7 +703,6 @@ Int TComPattern::isLeftAvailable(TComDat
                 *pbValidFlags = false;
             }
         }
-
         pbValidFlags--; // opposite direction
     }
 
@@ -820,7 +743,6 @@ Int TComPattern::isAboveRightAvailable(T
                 *pbValidFlags = false;
             }
         }
-
         pbValidFlags++;
     }
 
@@ -829,8 +751,7 @@ Int TComPattern::isAboveRightAvailable(T
 
 Int TComPattern::isBelowLeftAvailable(TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags)
 {
-    const UInt uiNumUnitsInPU =
-        (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInWidth() + 1;
+    const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInWidth() + 1;
     Bool *pbValidFlags = bValidFlags;
     Int iNumIntra = 0;
 
@@ -862,7 +783,6 @@ Int TComPattern::isBelowLeftAvailable(TC
                 *pbValidFlags = false;
             }
         }
-
         pbValidFlags--; // opposite direction
     }
 
--- a/source/Lib/TLibCommon/TComPattern.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPattern.h	Tue Apr 23 11:07:40 2013 +0530
@@ -67,7 +67,7 @@ public:
     Int   m_iPatternStride;
 
     /// return starting position of buffer
-    Pel*  getPatternOrigin()        { return m_piPatternOrigin;}
+    Pel*  getPatternOrigin()        { return m_piPatternOrigin; }
 
     /// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset])
     __inline Pel*  getROIOrigin()
@@ -107,13 +107,13 @@ private:
 public:
 
     // ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset])
-    Pel*  getROIY()                 { return m_cPatternY.getROIOrigin();}
+    Pel*  getROIY()                 { return m_cPatternY.getROIOrigin(); }
 
-    Int   getROIYWidth()            { return m_cPatternY.m_iROIWidth;}
+    Int   getROIYWidth()            { return m_cPatternY.m_iROIWidth; }
 
-    Int   getROIYHeight()           { return m_cPatternY.m_iROIHeight;}
+    Int   getROIYHeight()           { return m_cPatternY.m_iROIHeight; }
 
-    Int   getPatternLStride()       { return m_cPatternY.m_iPatternStride;}
+    Int   getPatternLStride()       { return m_cPatternY.m_iPatternStride; }
 
     // access functions of ADI buffers
     Int*  getAdiOrgBuf(Int iCuWidth, Int iCuHeight, Int* piAdiBuf);
@@ -165,20 +165,7 @@ public:
 private:
 
     /// padding of unavailable reference samples for intra prediction
-    Void  fillReferenceSamples(Int   bitDepth,
-                               Pel*  piRoiOrigin,
-                               Int*  piAdiTemp,
-                               Bool* bNeighborFlags,
-                               Int   iNumIntraNeighbor,
-                               Int   iUnitSize,
-                               Int   iNumUnitsInCu,
-                               Int   iTotalUnits,
-                               UInt  uiCuWidth,
-                               UInt  uiCuHeight,
-                               UInt  uiWidth,
-                               UInt  uiHeight,
-                               Int   iPicStride,
-                               Bool  bLMmode = false);
+    Void  fillReferenceSamples(Int bitDepth, Pel* piRoiOrigin, Int* piAdiTemp, Bool* bNeighborFlags, Int iNumIntraNeighbor, Int iUnitSize, Int iNumUnitsInCu, Int iTotalUnits, UInt uiCuWidth, UInt uiCuHeight, UInt uiWidth, UInt uiHeight, Int iPicStride, Bool bLMmode = false);
 
     /// constrained intra prediction
     Bool  isAboveLeftAvailable(TComDataCU* pcCU, UInt uiPartIdxLT);
--- a/source/Lib/TLibCommon/TComPic.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -71,15 +71,8 @@ TComPic::TComPic()
 TComPic::~TComPic()
 {}
 
-Void TComPic::create(Int     iWidth,
-                     Int     iHeight,
-                     UInt    uiMaxWidth,
-                     UInt    uiMaxHeight,
-                     UInt    uiMaxDepth,
-                     Window &conformanceWindow,
-                     Window &defaultDisplayWindow,
-                     Int *   numReorderPics,
-                     Bool    bIsVirtual)
+Void TComPic::create(Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
+                     Int *numReorderPics, Bool bIsVirtual)
 
 {
     m_apcPicSym     = new TComPicSym;
@@ -89,7 +82,6 @@ Void TComPic::create(Int     iWidth,
         m_apcPicYuv[0]  = new TComPicYuv;
         m_apcPicYuv[0]->create(iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth);
     }
-
     m_apcPicYuv[1]  = new TComPicYuv;
     m_apcPicYuv[1]->create(iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth);
 
@@ -98,7 +90,6 @@ Void TComPic::create(Int     iWidth,
     {
         deleteSEIs(m_SEIs);
     }
-
     m_bUsedByCurr = false;
 
     /* store conformance window parameters with picture */
@@ -182,7 +173,6 @@ Void TComPic::createNonDBFilterInfo(std:
             }
         }
     }
-
     m_sliceGranularityForNDBFilter = sliceGranularityDepth;
     m_bIndependentTileBoundaryForNDBFilter  = (bNDBFilterCrossTileBoundary) ? (false) : ((numTiles > 1) ? (true) : (false));
 
@@ -279,7 +269,6 @@ Void TComPic::createNonDBFilterInfo(std:
                 firstCUInStartLCU = 0;
                 assert(startLCU < getNumCUsInFrame());
             }
-
             assert(startLCU * maxNumSUInLCU + firstCUInStartLCU < endAddr);
         }
 
@@ -316,7 +305,6 @@ Void TComPic::createNonDBFilterInfo(std:
             {
                 continue;
             }
-
             Int iTileID = m_apcPicSym->getTileIdxMap(uiAddr);
             Bool bTopTileBoundary = false, bDownTileBoundary = false, bLeftTileBoundary = false, bRightTileBoundary = false;
 
@@ -327,19 +315,16 @@ Void TComPic::createNonDBFilterInfo(std:
                 {
                     bLeftTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr - 1) != iTileID) ? true : false;
                 }
-
                 //right
                 if ((uiAddr % numLCUsInPicWidth) != (numLCUsInPicWidth - 1))
                 {
                     bRightTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr + 1) != iTileID) ? true : false;
                 }
-
                 //top
                 if (uiAddr >= numLCUsInPicWidth)
                 {
                     bTopTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr - numLCUsInPicWidth) !=  iTileID) ? true : false;
                 }
-
                 //down
                 if (uiAddr + numLCUsInPicWidth < numLCUInPic)
                 {
@@ -347,21 +332,10 @@ Void TComPic::createNonDBFilterInfo(std:
                 }
             }
 
-            pcCU->setNDBFilterBlockBorderAvailability(numLCUsInPicWidth,
-                                                      numLCUsInPicHeight,
-                                                      maxNumSUInLCUWidth,
-                                                      maxNumSUInLCUHeight,
-                                                      picWidth,
-                                                      picHeight
-                                                      ,
-                                                      *LFCrossSliceBoundary
-                                                      ,
-                                                      bTopTileBoundary,
-                                                      bDownTileBoundary,
-                                                      bLeftTileBoundary,
-                                                      bRightTileBoundary
-                                                      ,
-                                                      m_bIndependentTileBoundaryForNDBFilter);
+            pcCU->setNDBFilterBlockBorderAvailability(numLCUsInPicWidth, numLCUsInPicHeight, maxNumSUInLCUWidth, maxNumSUInLCUHeight, picWidth, picHeight
+                                                      , *LFCrossSliceBoundary
+                                                      , bTopTileBoundary, bDownTileBoundary, bLeftTileBoundary, bRightTileBoundary
+                                                      , m_bIndependentTileBoundaryForNDBFilter);
         }
     }
 
@@ -382,14 +356,7 @@ Void TComPic::createNonDBFilterInfo(std:
  * \param picWidth picture width
  * \param picHeight picture height
  */
-Void TComPic::createNonDBFilterInfoLCU(Int         tileID,
-                                       Int         sliceID,
-                                       TComDataCU* pcCU,
-                                       UInt        startSU,
-                                       UInt        endSU,
-                                       Int         sliceGranularyDepth,
-                                       UInt        picWidth,
-                                       UInt        picHeight)
+Void TComPic::createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight)
 {
     UInt LCUX          = pcCU->getCUPelX();
     UInt LCUY          = pcCU->getCUPelY();
@@ -414,7 +381,6 @@ Void TComPic::createNonDBFilterInfoLCU(I
             {
                 break;
             }
-
             LPelX = LCUX + g_auiRasterToPelX[g_auiZscanToRaster[currSU]];
             TPelY = LCUY + g_auiRasterToPelY[g_auiZscanToRaster[currSU]];
         }
@@ -440,14 +406,12 @@ Void TComPic::createNonDBFilterInfoLCU(I
             {
                 break;
             }
-
             uiLPelX_su   = LCUX + g_auiRasterToPelX[g_auiZscanToRaster[uiIdx]];
             uiTPelY_su   = LCUY + g_auiRasterToPelY[g_auiZscanToRaster[uiIdx]];
             if (!(uiLPelX_su < picWidth) || !(uiTPelY_su < picHeight))
             {
                 continue;
             }
-
             pCUSliceMap[uiIdx] = sliceID;
             uiLastValidSU = uiIdx;
         }
@@ -482,7 +446,6 @@ Void TComPic::destroyNonDBFilterInfo()
         delete[] m_pSliceSUMap;
         m_pSliceSUMap = NULL;
     }
-
     for (UInt CUAddr = 0; CUAddr < getNumCUsInFrame(); CUAddr++)
     {
         TComDataCU* pcCU = getCU(CUAddr);
--- a/source/Lib/TLibCommon/TComPic.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.h	Tue Apr 23 11:07:40 2013 +0530
@@ -91,141 +91,127 @@ public:
     TComPic();
     virtual ~TComPic();
 
-    Void          create(Int     iWidth,
-                         Int     iHeight,
-                         UInt    uiMaxWidth,
-                         UInt    uiMaxHeight,
-                         UInt    uiMaxDepth,
-                         Window &conformanceWindow,
-                         Window &defaultDisplayWindow,
-                         Int *   numReorderPics,
-                         Bool    bIsVirtual = false);
+    Void          create(Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
+                         Int *numReorderPics, Bool bIsVirtual = false);
 
     virtual Void  destroy();
 
-    UInt          getTLayer()                { return m_uiTLayer;}
-
-    Void          setTLayer(UInt uiTLayer) { m_uiTLayer = uiTLayer;}
-
-    Bool          getUsedByCurr()             { return m_bUsedByCurr;}
-
-    Void          setUsedByCurr(Bool bUsed) { m_bUsedByCurr = bUsed;}
-
-    Bool          getIsLongTerm()             { return m_bIsLongTerm;}
-
-    Void          setIsLongTerm(Bool lt) { m_bIsLongTerm = lt;}
-
-    Void          setCheckLTMSBPresent(Bool b) { m_bCheckLTMSB = b;}
-
-    Bool          getCheckLTMSBPresent() { return m_bCheckLTMSB;}
-
-    TComPicSym*   getPicSym()           { return m_apcPicSym;}
-
-    TComSlice*    getSlice(Int i)       { return m_apcPicSym->getSlice(i);}
-
-    Int           getPOC()              { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC();}
-
-    TComDataCU*&  getCU(UInt uiCUAddr)  { return m_apcPicSym->getCU(uiCUAddr);}
-
-    TComPicYuv*   getPicYuvOrg()        { return m_apcPicYuv[0];}
-
-    TComPicYuv*   getPicYuvRec()        { return m_apcPicYuv[1];}
-
-    TComPicYuv*   getPicYuvPred()       { return m_pcPicYuvPred;}
-
-    TComPicYuv*   getPicYuvResi()       { return m_pcPicYuvResi;}
-
-    Void          setPicYuvPred(TComPicYuv* pcPicYuv)       { m_pcPicYuvPred = pcPicYuv;}
+    UInt          getTLayer()                { return m_uiTLayer; }
 
-    Void          setPicYuvResi(TComPicYuv* pcPicYuv)       { m_pcPicYuvResi = pcPicYuv;}
-
-    UInt          getNumCUsInFrame()      { return m_apcPicSym->getNumberOfCUsInFrame();}
-
-    UInt          getNumPartInWidth()     { return m_apcPicSym->getNumPartInWidth();}
-
-    UInt          getNumPartInHeight()    { return m_apcPicSym->getNumPartInHeight();}
-
-    UInt          getNumPartInCU()        { return m_apcPicSym->getNumPartition();}
-
-    UInt          getFrameWidthInCU()     { return m_apcPicSym->getFrameWidthInCU();}
-
-    UInt          getFrameHeightInCU()    { return m_apcPicSym->getFrameHeightInCU();}
-
-    UInt          getMinCUWidth()         { return m_apcPicSym->getMinCUWidth();}
-
-    UInt          getMinCUHeight()        { return m_apcPicSym->getMinCUHeight();}
+    Void          setTLayer(UInt uiTLayer) { m_uiTLayer = uiTLayer; }
 
-    UInt          getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx);}
-
-    UInt          getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx);}
-
-    Int           getStride()           { return m_apcPicYuv[1]->getStride();}
-
-    Int           getCStride()          { return m_apcPicYuv[1]->getCStride();}
+    Bool          getUsedByCurr()             { return m_bUsedByCurr; }
 
-    Void          setReconMark(Bool b) { m_bReconstructed = b;}
-
-    Bool          getReconMark()       { return m_bReconstructed;}
+    Void          setUsedByCurr(Bool bUsed) { m_bUsedByCurr = bUsed; }
 
-    Void          setOutputMark(Bool b) { m_bNeededForOutput = b;}
+    Bool          getIsLongTerm()             { return m_bIsLongTerm; }
 
-    Bool          getOutputMark()       { return m_bNeededForOutput;}
+    Void          setIsLongTerm(Bool lt) { m_bIsLongTerm = lt; }
 
-    Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;}
+    Void          setCheckLTMSBPresent(Bool b) { m_bCheckLTMSB = b; }
 
-    Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer];}
+    Bool          getCheckLTMSBPresent() { return m_bCheckLTMSB; }
+
+    TComPicSym*   getPicSym()           { return m_apcPicSym; }
+
+    TComSlice*    getSlice(Int i)       { return m_apcPicSym->getSlice(i); }
+
+    Int           getPOC()              { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC(); }
+
+    TComDataCU*&  getCU(UInt uiCUAddr)  { return m_apcPicSym->getCU(uiCUAddr); }
+
+    TComPicYuv*   getPicYuvOrg()        { return m_apcPicYuv[0]; }
+
+    TComPicYuv*   getPicYuvRec()        { return m_apcPicYuv[1]; }
+
+    TComPicYuv*   getPicYuvPred()       { return m_pcPicYuvPred; }
+
+    TComPicYuv*   getPicYuvResi()       { return m_pcPicYuvResi; }
+
+    Void          setPicYuvPred(TComPicYuv* pcPicYuv)       { m_pcPicYuvPred = pcPicYuv; }
+
+    Void          setPicYuvResi(TComPicYuv* pcPicYuv)       { m_pcPicYuvResi = pcPicYuv; }
+
+    UInt          getNumCUsInFrame()      { return m_apcPicSym->getNumberOfCUsInFrame(); }
+
+    UInt          getNumPartInWidth()     { return m_apcPicSym->getNumPartInWidth(); }
+
+    UInt          getNumPartInHeight()    { return m_apcPicSym->getNumPartInHeight(); }
+
+    UInt          getNumPartInCU()        { return m_apcPicSym->getNumPartition(); }
+
+    UInt          getFrameWidthInCU()     { return m_apcPicSym->getFrameWidthInCU(); }
+
+    UInt          getFrameHeightInCU()    { return m_apcPicSym->getFrameHeightInCU(); }
+
+    UInt          getMinCUWidth()         { return m_apcPicSym->getMinCUWidth(); }
+
+    UInt          getMinCUHeight()        { return m_apcPicSym->getMinCUHeight(); }
+
+    UInt          getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
+
+    UInt          getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
+
+    Int           getStride()           { return m_apcPicYuv[1]->getStride(); }
+
+    Int           getCStride()          { return m_apcPicYuv[1]->getCStride(); }
+
+    Void          setReconMark(Bool b) { m_bReconstructed = b; }
+
+    Bool          getReconMark()       { return m_bReconstructed; }
+
+    Void          setOutputMark(Bool b) { m_bNeededForOutput = b; }
+
+    Bool          getOutputMark()       { return m_bNeededForOutput; }
+
+    Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; }
+
+    Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
 
     Void          compressMotion();
-    UInt          getCurrSliceIdx()            { return m_uiCurrSliceIdx;}
-
-    Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i;}
-
-    UInt          getNumAllocatedSlice()       { return m_apcPicSym->getNumAllocatedSlice();}
+    UInt          getCurrSliceIdx()            { return m_uiCurrSliceIdx; }
 
-    Void          allocateNewSlice()           { m_apcPicSym->allocateNewSlice();}
+    Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i; }
 
-    Void          clearSliceBuffer()           { m_apcPicSym->clearSliceBuffer();}
+    UInt          getNumAllocatedSlice()       { return m_apcPicSym->getNumAllocatedSlice(); }
 
-    Window&       getConformanceWindow()  { return m_conformanceWindow;}
+    Void          allocateNewSlice()           { m_apcPicSym->allocateNewSlice(); }
 
-    Window&       getDefDisplayWindow()   { return m_defaultDisplayWindow;}
+    Void          clearSliceBuffer()           { m_apcPicSym->clearSliceBuffer(); }
+
+    Window&       getConformanceWindow()  { return m_conformanceWindow; }
+
+    Window&       getDefDisplayWindow()   { return m_defaultDisplayWindow; }
 
     Void          createNonDBFilterInfo(std::vector<Int> sliceStartAddress, Int sliceGranularityDepth
                                         , std::vector<Bool>* LFCrossSliceBoundary
                                         , Int  numTiles = 1
                                         , Bool bNDBFilterCrossTileBoundary = true);
-    Void          createNonDBFilterInfoLCU(Int         tileID,
-                                           Int         sliceID,
-                                           TComDataCU* pcCU,
-                                           UInt        startSU,
-                                           UInt        endSU,
-                                           Int         sliceGranularyDepth,
-                                           UInt        picWidth,
-                                           UInt        picHeight);
+    Void          createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight);
     Void          destroyNonDBFilterInfo();
 
-    Bool          getValidSlice(Int sliceID)  { return m_pbValidSlice[sliceID];}
-
-    Bool          getIndependentSliceBoundaryForNDBFilter()             { return m_bIndependentSliceBoundaryForNDBFilter;}
+    Bool          getValidSlice(Int sliceID)  { return m_pbValidSlice[sliceID]; }
 
-    Bool          getIndependentTileBoundaryForNDBFilter()             { return m_bIndependentTileBoundaryForNDBFilter;}
+    Bool          getIndependentSliceBoundaryForNDBFilter()             { return m_bIndependentSliceBoundaryForNDBFilter; }
 
-    TComPicYuv*   getYuvPicBufferForIndependentBoundaryProcessing()             { return m_pNDBFilterYuvTmp;}
+    Bool          getIndependentTileBoundaryForNDBFilter()             { return m_bIndependentTileBoundaryForNDBFilter; }
 
-    std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter(Int sliceID) { return m_vSliceCUDataLink[sliceID];}
+    TComPicYuv*   getYuvPicBufferForIndependentBoundaryProcessing()             { return m_pNDBFilterYuvTmp; }
+
+    std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter(Int sliceID) { return m_vSliceCUDataLink[sliceID]; }
 
     /** transfer ownership of seis to this picture */
-    void setSEIs(SEIMessages& seis) { m_SEIs = seis;}
+    void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
 
     /**
      * return the current list of SEI messages associated with this picture.
      * Pointer is valid until this->destroy() is called */
-    SEIMessages& getSEIs() { return m_SEIs;}
+    SEIMessages& getSEIs() { return m_SEIs; }
 
     /**
      * return the current list of SEI messages associated with this picture.
      * Pointer is valid until this->destroy() is called */
-    const SEIMessages& getSEIs() const { return m_SEIs;}
+    const SEIMessages& getSEIs() const { return m_SEIs; }
 }; // END CLASS DEFINITION TComPic
 
 //! \}
--- a/source/Lib/TLibCommon/TComPicSym.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicSym.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -98,9 +98,8 @@ Void TComPicSym::create(Int iPicWidth, I
             delete m_apcTComSlice[i];
         }
 
-        delete[] m_apcTComSlice;
+        delete [] m_apcTComSlice;
     }
-
     m_apcTComSlice      = new TComSlice*[m_uiNumCUsInFrame * m_uiNumPartitions];
     m_apcTComSlice[0]   = new TComSlice;
     m_uiNumAllocatedSlice = 1;
@@ -136,9 +135,8 @@ Void TComPicSym::destroy()
             delete m_apcTComSlice[i];
         }
 
-        delete[] m_apcTComSlice;
+        delete [] m_apcTComSlice;
     }
-
     m_apcTComSlice = NULL;
 
     for (Int i = 0; i < m_uiNumCUsInFrame; i++)
@@ -148,7 +146,7 @@ Void TComPicSym::destroy()
         m_apcTComDataCU[i] = NULL;
     }
 
-    delete[] m_apcTComDataCU;
+    delete [] m_apcTComDataCU;
     m_apcTComDataCU = NULL;
 
     for (Int i = 0; i < (m_iNumColumnsMinus1 + 1) * (m_iNumRowsMinus1 + 1); i++)
@@ -156,17 +154,17 @@ Void TComPicSym::destroy()
         delete m_apcTComTile[i];
     }
 
-    delete[] m_apcTComTile;
+    delete [] m_apcTComTile;
 
     m_apcTComTile = NULL;
 
-    delete[] m_puiCUOrderMap;
+    delete [] m_puiCUOrderMap;
     m_puiCUOrderMap = NULL;
 
-    delete[] m_puiTileIdxMap;
+    delete [] m_puiTileIdxMap;
     m_puiTileIdxMap = NULL;
 
-    delete[] m_puiInverseCUOrderMap;
+    delete [] m_puiInverseCUOrderMap;
     m_puiInverseCUOrderMap = NULL;
 
     if (m_saoParam)
@@ -253,10 +251,8 @@ Void TComPicSym::xInitTiles()
             this->getTComTile(uiTileIdx)->setBottomEdgePosInCU(uiBottomEdgePosInCU - 1);
 
             //initialize the FirstCUAddr for each tile
-            this->getTComTile(uiTileIdx)->setFirstCUAddr((this->getTComTile(uiTileIdx)->getBottomEdgePosInCU() -
-                                                          this->getTComTile(uiTileIdx)->getTileHeight() + 1) * m_uiWidthInCU +
-                                                         this->getTComTile(uiTileIdx)->getRightEdgePosInCU() -
-                                                         this->getTComTile(uiTileIdx)->getTileWidth() + 1);
+            this->getTComTile(uiTileIdx)->setFirstCUAddr((this->getTComTile(uiTileIdx)->getBottomEdgePosInCU() - this->getTComTile(uiTileIdx)->getTileHeight() + 1) * m_uiWidthInCU +
+                                                         this->getTComTile(uiTileIdx)->getRightEdgePosInCU() - this->getTComTile(uiTileIdx)->getTileWidth() + 1);
         }
     }
 
@@ -294,8 +290,7 @@ UInt TComPicSym::xCalculateNxtCUAddr(UIn
     uiTileIdx = this->getTileIdxMap(uiCurrCUAddr);
 
     //get the raster scan address for the next LCU
-    if (uiCurrCUAddr % m_uiWidthInCU == this->getTComTile(uiTileIdx)->getRightEdgePosInCU() && uiCurrCUAddr / m_uiWidthInCU ==
-        this->getTComTile(uiTileIdx)->getBottomEdgePosInCU())
+    if (uiCurrCUAddr % m_uiWidthInCU == this->getTComTile(uiTileIdx)->getRightEdgePosInCU() && uiCurrCUAddr / m_uiWidthInCU == this->getTComTile(uiTileIdx)->getBottomEdgePosInCU())
     //the current LCU is the last LCU of the tile
     {
         if (uiTileIdx == (m_iNumColumnsMinus1 + 1) * (m_iNumRowsMinus1 + 1) - 1)
--- a/source/Lib/TLibCommon/TComPicSym.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicSym.h	Tue Apr 23 11:07:40 2013 +0530
@@ -66,25 +66,25 @@ public:
     TComTile();
     virtual ~TComTile();
 
-    Void      setTileWidth(UInt i)            { m_uiTileWidth = i;}
-
-    UInt      getTileWidth()                  { return m_uiTileWidth;}
-
-    Void      setTileHeight(UInt i)           { m_uiTileHeight = i;}
-
-    UInt      getTileHeight()                 { return m_uiTileHeight;}
+    Void      setTileWidth(UInt i)            { m_uiTileWidth = i; }
 
-    Void      setRightEdgePosInCU(UInt i)     { m_uiRightEdgePosInCU = i;}
-
-    UInt      getRightEdgePosInCU()           { return m_uiRightEdgePosInCU;}
+    UInt      getTileWidth()                  { return m_uiTileWidth; }
 
-    Void      setBottomEdgePosInCU(UInt i)    { m_uiBottomEdgePosInCU = i;}
+    Void      setTileHeight(UInt i)           { m_uiTileHeight = i; }
 
-    UInt      getBottomEdgePosInCU()          { return m_uiBottomEdgePosInCU;}
+    UInt      getTileHeight()                 { return m_uiTileHeight; }
 
-    Void      setFirstCUAddr(UInt i)          { m_uiFirstCUAddr = i;}
+    Void      setRightEdgePosInCU(UInt i)     { m_uiRightEdgePosInCU = i; }
 
-    UInt      getFirstCUAddr()                { return m_uiFirstCUAddr;}
+    UInt      getRightEdgePosInCU()           { return m_uiRightEdgePosInCU; }
+
+    Void      setBottomEdgePosInCU(UInt i)    { m_uiBottomEdgePosInCU = i; }
+
+    UInt      getBottomEdgePosInCU()          { return m_uiBottomEdgePosInCU; }
+
+    Void      setFirstCUAddr(UInt i)          { m_uiFirstCUAddr = i; }
+
+    UInt      getFirstCUAddr()                { return m_uiFirstCUAddr; }
 };
 
 /// picture symbol class
@@ -126,59 +126,53 @@ public:
     Void        destroy();
 
     TComPicSym();
-    TComSlice*  getSlice(UInt i)          { return m_apcTComSlice[i];}
-
-    UInt        getFrameWidthInCU()       { return m_uiWidthInCU;}
-
-    UInt        getFrameHeightInCU()      { return m_uiHeightInCU;}
-
-    UInt        getMinCUWidth()           { return m_uiMinCUWidth;}
+    TComSlice*  getSlice(UInt i)          { return m_apcTComSlice[i]; }
 
-    UInt        getMinCUHeight()          { return m_uiMinCUHeight;}
-
-    UInt        getNumberOfCUsInFrame()   { return m_uiNumCUsInFrame;}
+    UInt        getFrameWidthInCU()       { return m_uiWidthInCU; }
 
-    TComDataCU*&  getCU(UInt uiCUAddr)  { return m_apcTComDataCU[uiCUAddr];}
+    UInt        getFrameHeightInCU()      { return m_uiHeightInCU; }
 
-    Void        setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p;}
+    UInt        getMinCUWidth()           { return m_uiMinCUWidth; }
 
-    UInt        getNumAllocatedSlice()    { return m_uiNumAllocatedSlice;}
+    UInt        getMinCUHeight()          { return m_uiMinCUHeight; }
+
+    UInt        getNumberOfCUsInFrame()   { return m_uiNumCUsInFrame; }
+
+    TComDataCU*&  getCU(UInt uiCUAddr)  { return m_apcTComDataCU[uiCUAddr]; }
+
+    Void        setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p; }
+
+    UInt        getNumAllocatedSlice()    { return m_uiNumAllocatedSlice; }
 
     Void        allocateNewSlice();
     Void        clearSliceBuffer();
-    UInt        getNumPartition()         { return m_uiNumPartitions;}
-
-    UInt        getNumPartInWidth()       { return m_uiNumPartInWidth;}
-
-    UInt        getNumPartInHeight()      { return m_uiNumPartInHeight;}
-
-    Void         setNumColumnsMinus1(Int i)                { m_iNumColumnsMinus1 = i;}
-
-    Int          getNumColumnsMinus1()                     { return m_iNumColumnsMinus1;}
-
-    Void         setNumRowsMinus1(Int i)                   { m_iNumRowsMinus1 = i;}
-
-    Int          getNumRowsMinus1()                        { return m_iNumRowsMinus1;}
-
-    Int          getNumTiles()                             { return (m_iNumRowsMinus1 + 1) * (m_iNumColumnsMinus1 + 1);}
+    UInt        getNumPartition()         { return m_uiNumPartitions; }
 
-    TComTile*    getTComTile(UInt tileIdx)                 { return *(m_apcTComTile + tileIdx);}
-
-    Void         setCUOrderMap(Int encCUOrder, Int cuAddr) { *(m_puiCUOrderMap + encCUOrder) = cuAddr;}
+    UInt        getNumPartInWidth()       { return m_uiNumPartInWidth; }
 
-    UInt         getCUOrderMap(Int encCUOrder)
-    {
-        return *(m_puiCUOrderMap + (encCUOrder >= m_uiNumCUsInFrame ? m_uiNumCUsInFrame : encCUOrder));
-    }
+    UInt        getNumPartInHeight()      { return m_uiNumPartInHeight; }
 
-    UInt         getTileIdxMap(Int i)                                { return *(m_puiTileIdxMap + i);}
-
-    Void         setInverseCUOrderMap(Int cuAddr, Int encCUOrder)    { *(m_puiInverseCUOrderMap + cuAddr) = encCUOrder;}
+    Void         setNumColumnsMinus1(Int i)                          { m_iNumColumnsMinus1 = i; }
 
-    UInt         getInverseCUOrderMap(Int cuAddr)
-    {
-        return *(m_puiInverseCUOrderMap + (cuAddr >= m_uiNumCUsInFrame ? m_uiNumCUsInFrame : cuAddr));
-    }
+    Int          getNumColumnsMinus1()                                 { return m_iNumColumnsMinus1; }
+
+    Void         setNumRowsMinus1(Int i)                             { m_iNumRowsMinus1 = i; }
+
+    Int          getNumRowsMinus1()                                    { return m_iNumRowsMinus1; }
+
+    Int          getNumTiles()                                         { return (m_iNumRowsMinus1 + 1) * (m_iNumColumnsMinus1 + 1); }
+
+    TComTile*    getTComTile(UInt tileIdx)                         { return *(m_apcTComTile + tileIdx); }
+
+    Void         setCUOrderMap(Int encCUOrder, Int cuAddr)           { *(m_puiCUOrderMap + encCUOrder) = cuAddr; }
+
+    UInt         getCUOrderMap(Int encCUOrder)                       { return *(m_puiCUOrderMap + (encCUOrder >= m_uiNumCUsInFrame ? m_uiNumCUsInFrame : encCUOrder)); }
+
+    UInt         getTileIdxMap(Int i)                                { return *(m_puiTileIdxMap + i); }
+
+    Void         setInverseCUOrderMap(Int cuAddr, Int encCUOrder)    { *(m_puiInverseCUOrderMap + cuAddr) = encCUOrder; }
+
+    UInt         getInverseCUOrderMap(Int cuAddr)                    { return *(m_puiInverseCUOrderMap + (cuAddr >= m_uiNumCUsInFrame ? m_uiNumCUsInFrame : cuAddr)); }
 
     UInt         getPicSCUEncOrder(UInt SCUAddr);
     UInt         getPicSCUAddr(UInt SCUEncOrder);
@@ -186,7 +180,7 @@ public:
     Void         xInitTiles();
     UInt         xCalculateNxtCUAddr(UInt uiCurrCUAddr);
     Void allocSaoParam(TComSampleAdaptiveOffset *sao);
-    SAOParam *getSaoParam() { return m_saoParam;}
+    SAOParam *getSaoParam() { return m_saoParam; }
 }; // END CLASS DEFINITION TComPicSym
 
 //! \}
--- a/source/Lib/TLibCommon/TComPicYuv.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -84,12 +84,9 @@ Void TComPicYuv::create(Int iPicWidth, I
     m_iChromaMarginX  = m_iLumaMarginX >> 1;
     m_iChromaMarginY  = m_iLumaMarginY >> 1;
 
-    m_apiPicBufY      =
-        (Pel*)xMalloc(Pel, (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
-    m_apiPicBufU      =
-        (Pel*)xMalloc(Pel, ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
-    m_apiPicBufV      =
-        (Pel*)xMalloc(Pel, ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
+    m_apiPicBufY      = (Pel*)xMalloc(Pel, (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
+    m_apiPicBufU      = (Pel*)xMalloc(Pel, ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
+    m_apiPicBufV      = (Pel*)xMalloc(Pel, ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
 
     m_piPicOrgY       = m_apiPicBufY + m_iLumaMarginY   * getStride()  + m_iLumaMarginX;
     m_piPicOrgU       = m_apiPicBufU + m_iChromaMarginY * getCStride() + m_iChromaMarginX;
@@ -114,13 +111,8 @@ Void TComPicYuv::create(Int iPicWidth, I
     {
         for (Int buCol = 0; buCol < (1 << uiMaxCUDepth); buCol++)
         {
-            m_buOffsetY[(buRow <<
-                         uiMaxCUDepth) +
-                        buCol] = getStride() * buRow * (uiMaxCUHeight >> uiMaxCUDepth) + buCol * (uiMaxCUWidth  >> uiMaxCUDepth);
-            m_buOffsetC[(buRow <<
-                         uiMaxCUDepth) +
-                        buCol] = getCStride() * buRow *
-                (uiMaxCUHeight / 2 >> uiMaxCUDepth) + buCol * (uiMaxCUWidth / 2 >> uiMaxCUDepth);
+            m_buOffsetY[(buRow << uiMaxCUDepth) + buCol] = getStride() * buRow * (uiMaxCUHeight >> uiMaxCUDepth) + buCol * (uiMaxCUWidth  >> uiMaxCUDepth);
+            m_buOffsetC[(buRow << uiMaxCUDepth) + buCol] = getCStride() * buRow * (uiMaxCUHeight / 2 >> uiMaxCUDepth) + buCol * (uiMaxCUWidth / 2 >> uiMaxCUDepth);
         }
     }
 }
@@ -131,11 +123,9 @@ Void TComPicYuv::destroy()
     m_piPicOrgU       = NULL;
     m_piPicOrgV       = NULL;
 
-    if (m_apiPicBufY) { xFree(m_apiPicBufY);m_apiPicBufY = NULL;}
-
-    if (m_apiPicBufU) { xFree(m_apiPicBufU);m_apiPicBufU = NULL;}
-
-    if (m_apiPicBufV) { xFree(m_apiPicBufV);m_apiPicBufV = NULL;}
+    if (m_apiPicBufY) { xFree(m_apiPicBufY);    m_apiPicBufY = NULL; }
+    if (m_apiPicBufU) { xFree(m_apiPicBufU);    m_apiPicBufU = NULL; }
+    if (m_apiPicBufV) { xFree(m_apiPicBufV);    m_apiPicBufV = NULL; }
 
     delete[] m_cuOffsetY;
     delete[] m_cuOffsetC;
@@ -158,8 +148,7 @@ Void TComPicYuv::createLuma(Int iPicWidt
     m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
     m_iLumaMarginY    = g_uiMaxCUHeight + 16; // margin for 8-tap filter and infinite padding
 
-    m_apiPicBufY      =
-        (Pel*)xMalloc(Pel, (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
+    m_apiPicBufY      = (Pel*)xMalloc(Pel, (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
     m_piPicOrgY       = m_apiPicBufY + m_iLumaMarginY   * getStride()  + m_iLumaMarginX;
 
     m_cuOffsetY = new Int[numCuInWidth * numCuInHeight];
@@ -178,9 +167,7 @@ Void TComPicYuv::createLuma(Int iPicWidt
     {
         for (Int buCol = 0; buCol < (1 << uiMaxCUDepth); buCol++)
         {
-            m_buOffsetY[(buRow <<
-                         uiMaxCUDepth) +
-                        buCol] = getStride() * buRow * (uiMaxCUHeight >> uiMaxCUDepth) + buCol * (uiMaxCUWidth  >> uiMaxCUDepth);
+            m_buOffsetY[(buRow << uiMaxCUDepth) + buCol] = getStride() * buRow * (uiMaxCUHeight >> uiMaxCUDepth) + buCol * (uiMaxCUWidth  >> uiMaxCUDepth);
         }
     }
 }
@@ -189,7 +176,7 @@ Void TComPicYuv::destroyLuma()
 {
     m_piPicOrgY       = NULL;
 
-    if (m_apiPicBufY) { xFree(m_apiPicBufY);m_apiPicBufY = NULL;}
+    if (m_apiPicBufY) { xFree(m_apiPicBufY);    m_apiPicBufY = NULL; }
 
     delete[] m_cuOffsetY;
     delete[] m_buOffsetY;
@@ -200,12 +187,9 @@ Void  TComPicYuv::copyToPic(TComPicYuv* 
     assert(m_iPicWidth  == pcPicYuvDst->getWidth());
     assert(m_iPicHeight == pcPicYuvDst->getHeight());
 
-    ::memcpy(pcPicYuvDst->getBufY(), m_apiPicBufY, sizeof(Pel) *
-             (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
-    ::memcpy(pcPicYuvDst->getBufU(), m_apiPicBufU, sizeof(Pel) *
-             ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
-    ::memcpy(pcPicYuvDst->getBufV(), m_apiPicBufV, sizeof(Pel) *
-             ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
+    ::memcpy(pcPicYuvDst->getBufY(), m_apiPicBufY, sizeof(Pel) * (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
+    ::memcpy(pcPicYuvDst->getBufU(), m_apiPicBufU, sizeof(Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
+    ::memcpy(pcPicYuvDst->getBufV(), m_apiPicBufV, sizeof(Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
 }
 
 Void  TComPicYuv::copyToPicLuma(TComPicYuv* pcPicYuvDst)
@@ -213,8 +197,7 @@ Void  TComPicYuv::copyToPicLuma(TComPicY
     assert(m_iPicWidth  == pcPicYuvDst->getWidth());
     assert(m_iPicHeight == pcPicYuvDst->getHeight());
 
-    ::memcpy(pcPicYuvDst->getBufY(), m_apiPicBufY, sizeof(Pel) *
-             (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
+    ::memcpy(pcPicYuvDst->getBufY(), m_apiPicBufY, sizeof(Pel) * (m_iPicWidth       + (m_iLumaMarginX << 1)) * (m_iPicHeight       + (m_iLumaMarginY << 1)));
 }
 
 Void  TComPicYuv::copyToPicCb(TComPicYuv* pcPicYuvDst)
@@ -222,8 +205,7 @@ Void  TComPicYuv::copyToPicCb(TComPicYuv
     assert(m_iPicWidth  == pcPicYuvDst->getWidth());
     assert(m_iPicHeight == pcPicYuvDst->getHeight());
 
-    ::memcpy(pcPicYuvDst->getBufU(), m_apiPicBufU, sizeof(Pel) *
-             ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
+    ::memcpy(pcPicYuvDst->getBufU(), m_apiPicBufU, sizeof(Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
 }
 
 Void  TComPicYuv::copyToPicCr(TComPicYuv* pcPicYuvDst)
@@ -231,8 +213,7 @@ Void  TComPicYuv::copyToPicCr(TComPicYuv
     assert(m_iPicWidth  == pcPicYuvDst->getWidth());
     assert(m_iPicHeight == pcPicYuvDst->getHeight());
 
-    ::memcpy(pcPicYuvDst->getBufV(), m_apiPicBufV, sizeof(Pel) *
-             ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
+    ::memcpy(pcPicYuvDst->getBufV(), m_apiPicBufV, sizeof(Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)));
 }
 
 Void TComPicYuv::extendPicBorder()
@@ -314,9 +295,9 @@ Void TComPicYuv::dump(Char* pFileName, B
     shift = g_bitDepthC - 8;
     offset = (shift > 0) ? (1 << (shift - 1)) : 0;
 
-    for (y = 0; y < (m_iPicHeight >> 1); y++)
+    for (y = 0; y < m_iPicHeight >> 1; y++)
     {
-        for (x = 0; x < (m_iPicWidth >> 1); x++)
+        for (x = 0; x < m_iPicWidth >> 1; x++)
         {
             uc = (UChar)Clip3<Pel>(0, 255, (piCb[x] + offset) >> shift);
             fwrite(&uc, sizeof(UChar), 1, pFile);
@@ -325,9 +306,9 @@ Void TComPicYuv::dump(Char* pFileName, B
         piCb += getCStride();
     }
 
-    for (y = 0; y < (m_iPicHeight >> 1); y++)
+    for (y = 0; y < m_iPicHeight >> 1; y++)
     {
-        for (x = 0; x < (m_iPicWidth >> 1); x++)
+        for (x = 0; x < m_iPicWidth >> 1; x++)
         {
             uc = (UChar)Clip3<Pel>(0, 255, (piCr[x] + offset) >> shift);
             fwrite(&uc, sizeof(UChar), 1, pFile);
@@ -340,3 +321,73 @@ Void TComPicYuv::dump(Char* pFileName, B
 }
 
 //! \}
+
+#include <stdint.h>
+
+/* Copy pixels from an input picture (C structure) into internal TComPicYuv instance
+ * Upscale pixels from 8bits to 16 bits when required, but do not modify pixels.
+ * This new routine is GPL
+ */
+Void TComPicYuv::copyFromPicture(const x265_picture& pic)
+{
+    Pel *Y = getLumaAddr();
+    Pel *U = getCbAddr();
+    Pel *V = getCrAddr();
+
+    uint8_t *y = (uint8_t*)pic.planes[0];
+    uint8_t *u = (uint8_t*)pic.planes[1];
+    uint8_t *v = (uint8_t*)pic.planes[2];
+
+#if HIGH_BIT_DEPTH
+    if (sizeof(Pel) * 8 > pic.bitDepth)
+    {
+        assert(pic.bitDepth == 8);
+
+        // Manually copy pixels to up-size them
+        for (int r = 0; r < m_iPicHeight; r++)
+        {
+            for (int c = 0; c < m_iPicWidth; c++)
+                Y[c] = (Pel) y[c];
+
+            Y += getStride();
+            y += pic.stride[0];
+        }
+        for (int r = 0; r < m_iPicHeight >> 1; r++)
+        {
+            for (int c = 0; c < m_iPicWidth >> 1; c++)
+            {
+                U[c] = (Pel) u[c];
+                V[c] = (Pel) v[c];
+            }
+
+            U += getCStride();
+            V += getCStride();
+            u += pic.stride[1];
+            v += pic.stride[2];
+        }
+    }
+    else
+#endif
+    {
+        int width = m_iPicWidth * (pic.bitDepth > 8 ? 2 : 1);
+
+        // copy pixels by row into encoder's buffer
+        for (int r = 0; r < m_iPicHeight; r++)
+        {
+            memcpy(Y, y, width);
+
+            Y += getStride();
+            y += pic.stride[0];
+        }
+        for (int r = 0; r < m_iPicHeight >> 1; r++)
+        {
+            memcpy(U, u, width >> 1);
+            memcpy(V, v, width >> 1);
+
+            U += getCStride();
+            V += getCStride();
+            u += pic.stride[1];
+            v += pic.stride[2];
+        }
+    }
+}
--- a/source/Lib/TLibCommon/TComPicYuv.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuv.h	Tue Apr 23 11:07:40 2013 +0530
@@ -39,6 +39,7 @@
 #define __TCOMPICYUV__
 
 #include <stdio.h>
+#include "x265.h"
 #include "CommonDef.h"
 #include "TComRom.h"
 
@@ -110,60 +111,48 @@ public:
     //  Get information of picture
     // ------------------------------------------------------------------------------------------------
 
-    Int   getWidth()     { return m_iPicWidth;}
-
-    Int   getHeight()     { return m_iPicHeight;}
+    Int   getWidth()     { return m_iPicWidth; }
 
-    Int   getStride()     { return (m_iPicWidth) + (m_iLumaMarginX << 1);}
+    Int   getHeight()     { return m_iPicHeight; }
 
-    Int   getCStride()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX << 1);}
+    Int   getStride()     { return (m_iPicWidth) + (m_iLumaMarginX << 1); }
 
-    Int   getLumaMargin() { return m_iLumaMarginX;}
+    Int   getCStride()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX << 1); }
 
-    Int   getChromaMargin() { return m_iChromaMarginX;}
+    Int   getLumaMargin() { return m_iLumaMarginX; }
+
+    Int   getChromaMargin() { return m_iChromaMarginX; }
 
     // ------------------------------------------------------------------------------------------------
     //  Access function for picture buffer
     // ------------------------------------------------------------------------------------------------
 
     //  Access starting position of picture buffer with margin
-    Pel*  getBufY()     { return m_apiPicBufY;}
+    Pel*  getBufY()     { return m_apiPicBufY; }
 
-    Pel*  getBufU()     { return m_apiPicBufU;}
+    Pel*  getBufU()     { return m_apiPicBufU; }
 
-    Pel*  getBufV()     { return m_apiPicBufV;}
+    Pel*  getBufV()     { return m_apiPicBufV; }
 
     //  Access starting position of original picture
-    Pel*  getLumaAddr()     { return m_piPicOrgY;}
+    Pel*  getLumaAddr()     { return m_piPicOrgY; }
 
-    Pel*  getCbAddr()     { return m_piPicOrgU;}
+    Pel*  getCbAddr()     { return m_piPicOrgU; }
 
-    Pel*  getCrAddr()     { return m_piPicOrgV;}
+    Pel*  getCrAddr()     { return m_piPicOrgV; }
 
     //  Access starting position of original picture for specific coding unit (CU) or partition unit (PU)
-    Pel*  getLumaAddr(Int iCuAddr) { return m_piPicOrgY + m_cuOffsetY[iCuAddr];}
-
-    Pel*  getCbAddr(Int iCuAddr) { return m_piPicOrgU + m_cuOffsetC[iCuAddr];}
-
-    Pel*  getCrAddr(Int iCuAddr) { return m_piPicOrgV + m_cuOffsetC[iCuAddr];}
+    Pel*  getLumaAddr(Int iCuAddr) { return m_piPicOrgY + m_cuOffsetY[iCuAddr]; }
 
-    Pel*  getLumaAddr(Int iCuAddr, Int uiAbsZorderIdx)
-    {
-        return m_piPicOrgY + m_cuOffsetY[iCuAddr] +
-               m_buOffsetY[g_auiZscanToRaster[uiAbsZorderIdx]];
-    }
+    Pel*  getCbAddr(Int iCuAddr) { return m_piPicOrgU + m_cuOffsetC[iCuAddr]; }
 
-    Pel*  getCbAddr(Int iCuAddr, Int uiAbsZorderIdx)
-    {
-        return m_piPicOrgU + m_cuOffsetC[iCuAddr] +
-               m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]];
-    }
+    Pel*  getCrAddr(Int iCuAddr) { return m_piPicOrgV + m_cuOffsetC[iCuAddr]; }
 
-    Pel*  getCrAddr(Int iCuAddr, Int uiAbsZorderIdx)
-    {
-        return m_piPicOrgV + m_cuOffsetC[iCuAddr] +
-               m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]];
-    }
+    Pel*  getLumaAddr(Int iCuAddr, Int uiAbsZorderIdx) { return m_piPicOrgY + m_cuOffsetY[iCuAddr] + m_buOffsetY[g_auiZscanToRaster[uiAbsZorderIdx]]; }
+
+    Pel*  getCbAddr(Int iCuAddr, Int uiAbsZorderIdx) { return m_piPicOrgU + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
+
+    Pel*  getCrAddr(Int iCuAddr, Int uiAbsZorderIdx) { return m_piPicOrgV + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
 
     // ------------------------------------------------------------------------------------------------
     //  Miscellaneous
@@ -174,6 +163,7 @@ public:
     Void  copyToPicLuma(TComPicYuv* pcPicYuvDst);
     Void  copyToPicCb(TComPicYuv* pcPicYuvDst);
     Void  copyToPicCr(TComPicYuv* pcPicYuvDst);
+    Void  copyFromPicture(const x265_picture&);
 
     //  Extend function of picture buffer
     Void  extendPicBorder();
@@ -182,7 +172,7 @@ public:
     Void  dump(Char* pFileName, Bool bAdd = false);
 
     // Set border extension flag
-    Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b;}
+    Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
 }; // END CLASS DEFINITION TComPicYuv
 
 void calcChecksum(TComPicYuv & pic, UChar digest[3][16]);
--- a/source/Lib/TLibCommon/TComPicYuvMD5.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuvMD5.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -32,7 +32,9 @@
  */
 
 #include "TComPicYuv.h"
-#include "libmd5/MD5.h"
+#include "md5.h"
+
+using namespace x265;
 
 //! \ingroup TLibCommon
 //! \{
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -63,7 +63,7 @@ TComPrediction::~TComPrediction()
 
     if (m_pLumaRecBuffer)
     {
-        delete[] m_pLumaRecBuffer;
+        delete [] m_pLumaRecBuffer;
     }
 
     Int i, j;
@@ -74,7 +74,7 @@ TComPrediction::~TComPrediction()
             m_filteredBlock[i][j].destroy();
         }
 
-        m_filteredBlockTmp[i].destroy();
+        filteredBlockTmp[i].destroy();
     }
 }
 
@@ -82,32 +82,32 @@ Void TComPrediction::initTempBuff()
 {
     if (m_piYuvExt == NULL)
     {
-        Int extWidth  = g_uiMaxCUWidth + 16;
-        Int extHeight = g_uiMaxCUHeight + 1;
+        Int extWidth  = MAX_CU_SIZE + 16;
+        Int extHeight = MAX_CU_SIZE + 1;
         Int i, j;
         for (i = 0; i < 4; i++)
         {
-            m_filteredBlockTmp[i].create(extWidth, extHeight + 7);
+            filteredBlockTmp[i].create(extWidth, extHeight + 7);
             for (j = 0; j < 4; j++)
             {
                 m_filteredBlock[i][j].create(extWidth, extHeight);
             }
         }
 
-        m_iYuvExtHeight  = ((g_uiMaxCUHeight + 2) << 4);
-        m_iYuvExtStride = ((g_uiMaxCUWidth  + 8) << 4);
+        m_iYuvExtHeight  = ((MAX_CU_SIZE + 2) << 4);
+        m_iYuvExtStride = ((MAX_CU_SIZE  + 8) << 4);
         m_piYuvExt = new Int[m_iYuvExtStride * m_iYuvExtHeight];
 
         // new structure
-        m_acYuvPred[0].create(g_uiMaxCUWidth, g_uiMaxCUHeight);
-        m_acYuvPred[1].create(g_uiMaxCUWidth, g_uiMaxCUHeight);
+        m_acYuvPred[0].create(MAX_CU_SIZE, MAX_CU_SIZE);
+        m_acYuvPred[1].create(MAX_CU_SIZE, MAX_CU_SIZE);
 
-        m_cYuvPredTemp.create(g_uiMaxCUWidth, g_uiMaxCUHeight);
+        m_cYuvPredTemp.create(MAX_CU_SIZE, MAX_CU_SIZE);
     }
 
-    if (m_iLumaRecStride != (g_uiMaxCUWidth >> 1) + 1)
+    if (m_iLumaRecStride != (MAX_CU_SIZE >> 1) + 1)
     {
-        m_iLumaRecStride =  (g_uiMaxCUWidth >> 1) + 1;
+        m_iLumaRecStride =  (MAX_CU_SIZE >> 1) + 1;
         if (!m_pLumaRecBuffer)
         {
             m_pLumaRecBuffer = new Pel[m_iLumaRecStride * m_iLumaRecStride];
@@ -132,7 +132,6 @@ Pel TComPrediction::predIntraGetPredValD
             iSum += pSrc[iInd - iSrcStride];
         }
     }
-
     if (bLeft)
     {
         for (iInd = 0; iInd < iHeight; iInd++)
@@ -182,17 +181,7 @@ Pel TComPrediction::predIntraGetPredValD
  * the predicted value for the pixel is linearly interpolated from the reference samples. All reference samples are taken
  * from the extended main reference.
  */
-Void TComPrediction::xPredIntraAng(Int   bitDepth,
-                                   Int*  pSrc,
-                                   Int   srcStride,
-                                   Pel*& rpDst,
-                                   Int   dstStride,
-                                   UInt  width,
-                                   UInt  height,
-                                   UInt  dirMode,
-                                   Bool  blkAboveAvailable,
-                                   Bool  blkLeftAvailable,
-                                   Bool  bFilter)
+Void TComPrediction::xPredIntraAng(Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter)
 {
     Int k, l;
     Int blkSize        = width;
@@ -313,9 +302,7 @@ Void TComPrediction::xPredIntraAng(Int  
                     for (l = 0; l < blkSize; l++)
                     {
                         refMainIndex        = l + deltaInt + 1;
-                        pDst[k * dstStride +
-                             l] =
-                            (Pel)(((32 - deltaFract) * refMain[refMainIndex] + deltaFract * refMain[refMainIndex + 1] + 16) >> 5);
+                        pDst[k * dstStride + l] = (Pel)(((32 - deltaFract) * refMain[refMainIndex] + deltaFract * refMain[refMainIndex + 1] + 16) >> 5);
                     }
                 }
                 else
@@ -346,14 +333,7 @@ Void TComPrediction::xPredIntraAng(Int  
     }
 }
 
-Void TComPrediction::predIntraLumaAng(TComPattern* pcTComPattern,
-                                      UInt         uiDirMode,
-                                      Pel*         piPred,
-                                      UInt         uiStride,
-                                      Int          iWidth,
-                                      Int          iHeight,
-                                      Bool         bAbove,
-                                      Bool         bLeft)
+Void TComPrediction::predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft)
 {
     Pel *pDst = piPred;
     Int *ptrSrc;
@@ -391,14 +371,7 @@ Void TComPrediction::predIntraLumaAng(TC
 }
 
 // Angular chroma
-Void TComPrediction::predIntraChromaAng(Int* piSrc,
-                                        UInt uiDirMode,
-                                        Pel* piPred,
-                                        UInt uiStride,
-                                        Int  iWidth,
-                                        Int  iHeight,
-                                        Bool bAbove,
-                                        Bool bLeft)
+Void TComPrediction::predIntraChromaAng(Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft)
 {
     Pel *pDst = piPred;
     Int *ptrSrc = piSrc;
@@ -425,21 +398,16 @@ Bool TComPrediction::xCheckIdenticalMoti
 {
     if (pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getPPS()->getWPBiPred())
     {
-        if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr) >= 0 &&
-            pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr) >= 0)
+        if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr) >= 0 && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr) >= 0)
         {
-            Int RefPOCL0 =
-                pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC();
-            Int RefPOCL1 =
-                pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC();
-            if (RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) ==
-                pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
+            Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC();
+            Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC();
+            if (RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
             {
                 return true;
             }
         }
     }
-
     return false;
 }
 
@@ -462,7 +430,6 @@ Void TComPrediction::motionCompensation(
             {
                 xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred);
             }
-
             if (pcCU->getSlice()->getPPS()->getUseWP())
             {
                 xWeightedPredictionUni(pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred);
@@ -479,7 +446,6 @@ Void TComPrediction::motionCompensation(
                 xPredInterBi(pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred);
             }
         }
-
         return;
     }
 
@@ -497,7 +463,6 @@ Void TComPrediction::motionCompensation(
             {
                 xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred);
             }
-
             if (pcCU->getSlice()->getPPS()->getUseWP())
             {
                 xWeightedPredictionUni(pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred);
@@ -517,26 +482,16 @@ Void TComPrediction::motionCompensation(
     }
 }
 
-Void TComPrediction::xPredInterUni(TComDataCU* pcCU,
-                                   UInt        uiPartAddr,
-                                   Int         iWidth,
-                                   Int         iHeight,
-                                   RefPicList  eRefPicList,
-                                   TComYuv*&   rpcYuvPred,
-                                   Bool        bi)
+Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi)
 {
     Int         iRefIdx     = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
 
     assert(iRefIdx >= 0);
+    TComMv      cMv         = pcCU->getCUMvField(eRefPicList)->getMv(uiPartAddr);
 
-    TComMv      cMv         = pcCU->getCUMvField(eRefPicList)->getMv(uiPartAddr);
     pcCU->clipMv(cMv);
-    xPredInterLumaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList,
-                                                        iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred,
-                      bi);
-    xPredInterChromaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList,
-                                                          iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred,
-                        bi);
+    xPredInterLumaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi);
+    xPredInterChromaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi);
 }
 
 Void TComPrediction::xPredInterBi(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred)
@@ -557,8 +512,7 @@ Void TComPrediction::xPredInterBi(TComDa
         assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));
 
         pcMbYuv = &m_acYuvPred[iRefList];
-        if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr) >= 0 &&
-            pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr) >= 0)
+        if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr) >= 0 && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr) >= 0)
         {
             xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
         }
@@ -578,15 +532,7 @@ Void TComPrediction::xPredInterBi(TComDa
 
     if (pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE)
     {
-        xWeightedPredictionBi(pcCU,
-                              &m_acYuvPred[0],
-                              &m_acYuvPred[1],
-                              iRefIdx[0],
-                              iRefIdx[1],
-                              uiPartAddr,
-                              iWidth,
-                              iHeight,
-                              rpcYuvPred);
+        xWeightedPredictionBi(pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
     }
     else if (pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType() == P_SLICE)
     {
@@ -610,21 +556,14 @@ Void TComPrediction::xPredInterBi(TComDa
  * \param dstPic   Pointer to destination picture
  * \param bi       Flag indicating whether bipred is used
  */
-Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu,
-                                       TComPicYuv *refPic,
-                                       UInt        partAddr,
-                                       TComMv *    mv,
-                                       Int         width,
-                                       Int         height,
-                                       TComYuv *&  dstPic,
-                                       Bool        bi)
+Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi)
 {
     Int refStride = refPic->getStride();
     Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) * refStride;
-    Pel *ref      = refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
+    Short *ref      = (Short *) refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
 
     Int dstStride = dstPic->getStride();
-    Pel *dst      = dstPic->getLumaAddr(partAddr);
+    Short *dst      = (Short *) dstPic->getLumaAddr(partAddr);
 
     Int xFrac = mv->getHor() & 0x3;
     Int yFrac = mv->getVer() & 0x3;
@@ -639,12 +578,12 @@ Void TComPrediction::xPredInterLumaBlk(T
     }
     else
     {
-        Int tmpStride = m_filteredBlockTmp[0].getStride();
-        Pel *tmp    = m_filteredBlockTmp[0].getLumaAddr();
-
+        Int tmpStride = width;
         Int filterSize = NTAPS_LUMA;
         Int halfFilterSize = (filterSize >> 1);
 
+        Short *tmp    = (Short*)malloc(width * (height + filterSize - 1) * sizeof(Short));
+
         m_if.filterHorLuma(ref - (halfFilterSize - 1) * refStride,
                            refStride,
                            tmp,
@@ -662,6 +601,7 @@ Void TComPrediction::xPredInterLumaBlk(T
                            yFrac,
                            false,
                            !bi);
+        free(tmp);
     }
 }
 
@@ -677,38 +617,31 @@ Void TComPrediction::xPredInterLumaBlk(T
  * \param dstPic   Pointer to destination picture
  * \param bi       Flag indicating whether bipred is used
  */
-Void TComPrediction::xPredInterChromaBlk(TComDataCU *cu,
-                                         TComPicYuv *refPic,
-                                         UInt        partAddr,
-                                         TComMv *    mv,
-                                         Int         width,
-                                         Int         height,
-                                         TComYuv *&  dstPic,
-                                         Bool        bi)
+Void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi)
 {
     Int     refStride  = refPic->getCStride();
     Int     dstStride  = dstPic->getCStride();
 
     Int     refOffset  = (mv->getHor() >> 3) + (mv->getVer() >> 3) * refStride;
 
-    Pel*    refCb     = refPic->getCbAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
-    Pel*    refCr     = refPic->getCrAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
+    Short*    refCb     = (Short *) refPic->getCbAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
+    Short*    refCr     = (Short *) refPic->getCrAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
 
-    Pel* dstCb = dstPic->getCbAddr(partAddr);
-    Pel* dstCr = dstPic->getCrAddr(partAddr);
+    Short* dstCb = (Short *) dstPic->getCbAddr(partAddr);
+    Short* dstCr = (Short *) dstPic->getCrAddr(partAddr);
 
     Int     xFrac  = mv->getHor() & 0x7;
     Int     yFrac  = mv->getVer() & 0x7;
     UInt    cxWidth  = width  >> 1;
     UInt    cxHeight = height >> 1;
 
-    Int     extStride = m_filteredBlockTmp[0].getStride();
-    Short*  extY      = m_filteredBlockTmp[0].getLumaAddr();
-
     Int filterSize = NTAPS_CHROMA;
 
     Int halfFilterSize = (filterSize >> 1);
 
+    Int     extStride = cxWidth;
+    Short*  extY      = (Short*)malloc(cxWidth * (cxHeight + filterSize - 1) * sizeof(Short));
+
     if (yFrac == 0)
     {
         m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi);
@@ -721,52 +654,16 @@ Void TComPrediction::xPredInterChromaBlk
     }
     else
     {
-        m_if.filterHorChroma(refCb - (halfFilterSize - 1) * refStride,
-                             refStride,
-                             extY,
-                             extStride,
-                             cxWidth,
-                             cxHeight + filterSize - 1,
-                             xFrac,
-                             false);
-        m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride,
-                             extStride,
-                             dstCb,
-                             dstStride,
-                             cxWidth,
-                             cxHeight,
-                             yFrac,
-                             false,
-                             !bi);
+        m_if.filterHorChroma(refCb - (halfFilterSize - 1) * refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac, false);
+        m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, false, !bi);
 
-        m_if.filterHorChroma(refCr - (halfFilterSize - 1) * refStride,
-                             refStride,
-                             extY,
-                             extStride,
-                             cxWidth,
-                             cxHeight + filterSize - 1,
-                             xFrac,
-                             false);
-        m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride,
-                             extStride,
-                             dstCr,
-                             dstStride,
-                             cxWidth,
-                             cxHeight,
-                             yFrac,
-                             false,
-                             !bi);
+        m_if.filterHorChroma(refCr - (halfFilterSize - 1) * refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac, false);
+        m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, false, !bi);
     }
+    free(extY);
 }
 
-Void TComPrediction::xWeightedAverage(TComYuv*  pcYuvSrc0,
-                                      TComYuv*  pcYuvSrc1,
-                                      Int       iRefIdx0,
-                                      Int       iRefIdx1,
-                                      UInt      uiPartIdx,
-                                      Int       iWidth,
-                                      Int       iHeight,
-                                      TComYuv*& rpcYuvDst)
+Void TComPrediction::xWeightedAverage(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst)
 {
     if (iRefIdx0 >= 0 && iRefIdx1 >= 0)
     {
@@ -876,9 +773,7 @@ Void TComPrediction::xDCPredFiltering(In
         pDst[x] = (Pel)((pSrc[x - iSrcStride] +  3 * pDst[x] + 2) >> 2);
     }
 
-    for (y = 1, iDstStride2 = iDstStride, iSrcStride2 = iSrcStride - 1;
-         y < iHeight;
-         y++, iDstStride2 += iDstStride, iSrcStride2 += iSrcStride)
+    for (y = 1, iDstStride2 = iDstStride, iSrcStride2 = iSrcStride - 1; y < iHeight; y++, iDstStride2 += iDstStride, iSrcStride2 += iSrcStride)
     {
         pDst[iDstStride2] = (Pel)((pSrc[iSrcStride2] + 3 * pDst[iDstStride2] + 2) >> 2);
     }
--- a/source/Lib/TLibCommon/TComPrediction.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.h	Tue Apr 23 11:07:40 2013 +0530
@@ -53,6 +53,74 @@
 // Class definition
 // ====================================================================================================================
 
+//Defining a class with Short YUV storage for filtering operations
+class TShortYUV
+{
+private:
+
+    short* YBuf;
+    short* CbBuf;
+    short* CrBuf;
+
+    unsigned int width;
+    unsigned int height;
+    unsigned int Cwidth;
+    unsigned int Cheight;
+
+public:
+
+    TShortYUV()
+    {
+        YBuf = NULL;
+        CbBuf = NULL;
+        CrBuf = NULL;
+    }
+
+    void create(unsigned int Width, unsigned int Height)
+    {
+        YBuf  = (short*)xMalloc(short, Width * Height);
+        CbBuf  = (short*)xMalloc(short, Width * Height >> 2);
+        CrBuf  = (short*)xMalloc(short, Width * Height >> 2);
+
+        // set width and height
+        width   = Width;
+        height  = Height;
+        Cwidth  = Width  >> 1;
+        Cheight = Height >> 1;
+    }
+
+    void destroy()
+    {
+        xFree(YBuf);
+        YBuf = NULL;
+        xFree(CbBuf);
+        CbBuf = NULL;
+        xFree(CrBuf);
+        CrBuf = NULL;
+    }
+
+    void clear()
+    {
+        ::memset(YBuf, 0, (width  * height) * sizeof(short));
+        ::memset(CbBuf, 0, (Cwidth * Cheight) * sizeof(short));
+        ::memset(CrBuf, 0, (Cwidth * Cheight) * sizeof(short));
+    }
+
+    Short*    getLumaAddr()    { return YBuf; }
+
+    Short*    getCbAddr()    { return CbBuf; }
+
+    Short*    getCrAddr()    { return CrBuf; }
+
+    unsigned int    getHeight()    { return height; }
+
+    unsigned int    getWidth()    { return width; }
+
+    unsigned int    getCHeight()    { return Cheight; }
+
+    unsigned int    getCWidth()    { return Cwidth; }
+};
+
 /// prediction class
 class TComPrediction : public TComWeightPrediction
 {
@@ -64,73 +132,27 @@ protected:
 
     TComYuv   m_acYuvPred[2];
     TComYuv   m_cYuvPredTemp;
-    TComYuv m_filteredBlock[4][4];
-    TComYuv m_filteredBlockTmp[4];
+    /*This holds final interpolated pixel values (0-255). Hence memory is stored as Pel.*/
+    TComYuv m_filteredBlock[4][4]; 
+    /*This holds intermediate values for filtering operations which need to maintain Short precision*/
+    TShortYUV filteredBlockTmp[4];//This 
 
     TComInterpolationFilter m_if;
 
     Pel*   m_pLumaRecBuffer;     ///< array for downsampled reconstructed luma sample
     Int    m_iLumaRecStride;     ///< stride of #m_pLumaRecBuffer array
 
-    Void xPredIntraAng(Int   bitDepth,
-                       Int*  pSrc,
-                       Int   srcStride,
-                       Pel*& rpDst,
-                       Int   dstStride,
-                       UInt  width,
-                       UInt  height,
-                       UInt  dirMode,
-                       Bool  blkAboveAvailable,
-                       Bool  blkLeftAvailable,
-                       Bool  bFilter);
+    Void xPredIntraAng(Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter);
     Void xPredIntraPlanar(Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height);
 
     // motion compensation functions
-    Void xPredInterUni(TComDataCU* pcCU,
-                       UInt        uiPartAddr,
-                       Int         iWidth,
-                       Int         iHeight,
-                       RefPicList  eRefPicList,
-                       TComYuv*&   rpcYuvPred,
-                       Bool        bi = false);
-    Void xPredInterBi(TComDataCU* pcCU,
-                      UInt        uiPartAddr,
-                      Int         iWidth,
-                      Int         iHeight,
-                      TComYuv*&   rpcYuvPred);
-    Void xPredInterLumaBlk(TComDataCU *cu,
-                           TComPicYuv *refPic,
-                           UInt        partAddr,
-                           TComMv *    mv,
-                           Int         width,
-                           Int         height,
-                           TComYuv *&  dstPic,
-                           Bool        bi);
-    Void xPredInterChromaBlk(TComDataCU *cu,
-                             TComPicYuv *refPic,
-                             UInt        partAddr,
-                             TComMv *    mv,
-                             Int         width,
-                             Int         height,
-                             TComYuv *&  dstPic,
-                             Bool        bi);
-    Void xWeightedAverage(TComYuv*  pcYuvSrc0,
-                          TComYuv*  pcYuvSrc1,
-                          Int       iRefIdx0,
-                          Int       iRefIdx1,
-                          UInt      uiPartAddr,
-                          Int       iWidth,
-                          Int       iHeight,
-                          TComYuv*& rpcYuvDst);
+    Void xPredInterUni(TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi = false);
+    Void xPredInterBi(TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred);
+    Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi);
+    Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi);
+    Void xWeightedAverage(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst);
 
-    Void xGetLLSPrediction(TComPattern* pcPattern,
-                           Int*         pSrc0,
-                           Int          iSrcStride,
-                           Pel*         pDst0,
-                           Int          iDstStride,
-                           UInt         uiWidth,
-                           UInt         uiHeight,
-                           UInt         uiExt0);
+    Void xGetLLSPrediction(TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0);
 
     Void xDCPredFiltering(Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight);
     Bool xCheckIdenticalMotion(TComDataCU* pcCU, UInt PartAddr);
@@ -149,30 +171,16 @@ public:
     Void getMvPredAMVP(TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred);
 
     // Angular Intra
-    Void predIntraLumaAng(TComPattern* pcTComPattern,
-                          UInt         uiDirMode,
-                          Pel*         piPred,
-                          UInt         uiStride,
-                          Int          iWidth,
-                          Int          iHeight,
-                          Bool         bAbove,
-                          Bool         bLeft);
-    Void predIntraChromaAng(Int* piSrc,
-                            UInt uiDirMode,
-                            Pel* piPred,
-                            UInt uiStride,
-                            Int  iWidth,
-                            Int  iHeight,
-                            Bool bAbove,
-                            Bool bLeft);
+    Void predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft);
+    Void predIntraChromaAng(Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft);
 
     Pel  predIntraGetPredValDC(Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft);
 
-    Int* getPredicBuf()             { return m_piYuvExt;}
+    Int* getPredicBuf()             { return m_piYuvExt; }
 
-    Int  getPredicBufWidth()        { return m_iYuvExtStride;}
+    Int  getPredicBufWidth()        { return m_iYuvExtStride; }
 
-    Int  getPredicBufHeight()       { return m_iYuvExtHeight;}
+    Int  getPredicBufHeight()       { return m_iYuvExtHeight; }
 };
 
 //! \}
--- a/source/Lib/TLibCommon/TComRdCost.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComRdCost.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -261,7 +261,7 @@ Void TComRdCost::xUninit()
 {
     if (NULL != m_puiComponentCostOriginP)
     {
-        delete[] m_puiComponentCostOriginP;
+        delete [] m_puiComponentCostOriginP;
         m_puiComponentCostOriginP = NULL;
     }
 }
@@ -323,7 +323,6 @@ Void TComRdCost::setDistParam(TComPatter
     {
         rcDistParam.DistFunc = m_afpDistortFunc[45];
     }
-
 #endif // if AMP_SAD
 
     // initialize
@@ -332,21 +331,10 @@ Void TComRdCost::setDistParam(TComPatter
 
 // Setting the Distortion Parameter for Inter (subpel ME with step)
 #if NS_HAD
-Void TComRdCost::setDistParam(TComPattern* pcPatternKey,
-                              Pel*         piRefY,
-                              Int          iRefStride,
-                              Int          iStep,
-                              DistParam&   rcDistParam,
-                              Bool         bHADME,
-                              Bool         bUseNSHAD)
+Void TComRdCost::setDistParam(TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME, Bool bUseNSHAD)
 #else
-Void TComRdCost::setDistParam(TComPattern* pcPatternKey,
-                              Pel*         piRefY,
-                              Int          iRefStride,
-                              Int          iStep,
-                              DistParam&   rcDistParam,
-                              Bool         bHADME)
-#endif // if NS_HAD
+Void TComRdCost::setDistParam(TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME)
+#endif
 {
     // set Original & Curr Pointer / Stride
     rcDistParam.pOrg = pcPatternKey->getROIY();
@@ -396,26 +384,10 @@ Void TComRdCost::setDistParam(TComPatter
 
 Void
 #if NS_HAD
-TComRdCost::setDistParam(DistParam& rcDP,
-                         Pel*       p1,
-                         Int        iStride1,
-                         Pel*       p2,
-                         Int        iStride2,
-                         Int        iWidth,
-                         Int        iHeight,
-                         Bool       bHadamard,
-                         Bool       bUseNSHAD)
+TComRdCost::setDistParam(DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard, Bool bUseNSHAD)
 #else
-TComRdCost::setDistParam(DistParam & rcDP,
-                         Int bitDepth,
-                         Pel * p1,
-                         Int iStride1,
-                         Pel * p2,
-                         Int iStride2,
-                         Int iWidth,
-                         Int iHeight,
-                         Bool bHadamard)
-#endif // if NS_HAD
+TComRdCost::setDistParam(DistParam & rcDP, Int bitDepth, Pel * p1, Int iStride1, Pel * p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard)
+#endif
 {
     rcDP.pOrg       = p1;
     rcDP.pCur       = p2;
@@ -481,25 +453,10 @@ UInt TComRdCost::calcHAD(Int bitDepth, P
 }
 
 #if WEIGHTED_CHROMA_DISTORTION
-UInt TComRdCost::getDistPart(Int      bitDepth,
-                             Pel*     piCur,
-                             Int      iCurStride,
-                             Pel*     piOrg,
-                             Int      iOrgStride,
-                             UInt     uiBlkWidth,
-                             UInt     uiBlkHeight,
-                             TextType eText,
-                             DFunc    eDFunc)
+UInt TComRdCost::getDistPart(Int bitDepth, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, TextType eText, DFunc eDFunc)
 #else
-UInt TComRdCost::getDistPart(Int   bitDepth,
-                             Pel*  piCur,
-                             Int   iCurStride,
-                             Pel*  piOrg,
-                             Int   iOrgStride,
-                             UInt  uiBlkWidth,
-                             UInt  uiBlkHeight,
-                             DFunc eDFunc)
-#endif // if WEIGHTED_CHROMA_DISTORTION
+UInt TComRdCost::getDistPart(Int bitDepth, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc)
+#endif
 {
     DistParam cDtParam;
 
@@ -543,10 +500,14 @@ UInt TComRdCost::getSADPart(Int bitDepth
     {
         int part = x265::PartitionFromSizes(width, height);
         if (part >= 0)
-            return x265::primitives.sad[part]((pixel*)pelCur, curStride, (pixel*)pelOrg, orgStride)>>shift;
+        {
+            UInt cost = x265::primitives.sad[part]((pixel*)pelCur, curStride, (pixel*)pelOrg, orgStride);
+            x264_cpu_emms();
+            return cost;
+        }
     }
 
-#endif
+#endif // if ENABLE_PRIMITIVES
 
     UInt SAD = 0;
     for (Int i = 0; i < height; i++)
@@ -628,8 +589,8 @@ UInt TComRdCost::xGetSAD4(DistParam* pcD
 #if ENABLE_PRIMITIVES
     int part = x265::PartitionFromSizes(4, iRows >> iSubShift);
     if (part >= 0)
-        return ((x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) <<iSubShift) >>
-                 DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8));
+        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
+               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
 #endif
 
     UInt uiSum = 0;
@@ -667,8 +628,8 @@ UInt TComRdCost::xGetSAD8(DistParam* pcD
 #if ENABLE_PRIMITIVES
     int part = x265::PartitionFromSizes(8, iRows >> iSubShift);
     if (part >= 0)
-        return ((x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-                DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8));
+        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
+               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
 #endif
 
     UInt uiSum = 0;
@@ -710,8 +671,8 @@ UInt TComRdCost::xGetSAD16(DistParam* pc
 #if ENABLE_PRIMITIVES
     int part = x265::PartitionFromSizes(16, iRows >> iSubShift);
     if (part >= 0)
-        return ((x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-                DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8));
+        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
+               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
 #endif
 
     UInt uiSum = 0;
@@ -802,8 +763,8 @@ UInt TComRdCost::xGetSAD16N(DistParam* p
 #if ENABLE_PRIMITIVES
     int part = x265::PartitionFromSizes(iCols, iRows >> iSubShift);
     if (part >= 0)
-        return ((x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-                 DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8));
+        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
+               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
 #endif
 
     for (; iRows != 0; iRows -= iSubStep)
@@ -854,8 +815,8 @@ UInt TComRdCost::xGetSAD32(DistParam* pc
 #if ENABLE_PRIMITIVES
     int part = x265::PartitionFromSizes(32, iRows >> iSubShift);
     if (part >= 0)
-        return ((x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-                DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8));
+        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
+               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
 #endif
 
     UInt uiSum = 0;
@@ -1254,7 +1215,6 @@ UInt TComRdCost::xGetSSE16(DistParam* pc
         assert(pcDtParam->iCols == 16);
         return xGetSSEw(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -1314,7 +1274,6 @@ UInt TComRdCost::xGetSSE16N(DistParam* p
     {
         return xGetSSEw(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -1378,7 +1337,6 @@ UInt TComRdCost::xGetSSE32(DistParam* pc
         assert(pcDtParam->iCols == 32);
         return xGetSSEw(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -1470,7 +1428,6 @@ UInt TComRdCost::xGetSSE64(DistParam* pc
         assert(pcDtParam->iCols == 64);
         return xGetSSEw(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -1650,7 +1607,9 @@ UInt TComRdCost::xCalcHADs4x4(Pel *piOrg
     assert(iStep == 1);
 
 #if ENABLE_PRIMITIVES
-    return x265::primitives.satd[x265::PARTITION_4x4]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+    UInt cost = x265::primitives.satd[x265::PARTITION_4x4]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+    x264_cpu_emms();
+    return cost;
 #else
     Int k, satd = 0, diff[16], m[16], d[16];
 
@@ -1751,7 +1710,9 @@ UInt TComRdCost::xCalcHADs8x8(Pel *piOrg
 {
     assert(iStep == 1);
 #if ENABLE_PRIMITIVES
-    return x265::primitives.sa8d_8x8((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+    UInt cost = x265::primitives.sa8d_8x8((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+    x264_cpu_emms();
+    return cost;
 #else
     Int k, i, j, jj, sad = 0;
     Int diff[64], m1[8][8], m2[8][8], m3[8][8];
@@ -2102,7 +2063,6 @@ UInt TComRdCost::xGetHADs4(DistParam* pc
     {
         return xGetHADs4w(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -2118,8 +2078,9 @@ UInt TComRdCost::xGetHADs4(DistParam* pc
     for (y = 0; y < iRows; y += 4)
     {
 #ifdef ENABLE_PRIMITIVES
-        assert(iStep==1);
+        assert(iStep == 1);
         uiSum += x265::primitives.satd[x265::PARTITION_4x4]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+        x264_cpu_emms();
 #else
         uiSum += xCalcHADs4x4(piOrg, piCur, iStrideOrg, iStrideCur, iStep);
 #endif
@@ -2136,7 +2097,6 @@ UInt TComRdCost::xGetHADs8(DistParam* pc
     {
         return xGetHADs8w(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -2150,8 +2110,9 @@ UInt TComRdCost::xGetHADs8(DistParam* pc
     if (iRows == 4)
     {
 #ifdef ENABLE_PRIMITIVES
-        assert(iStep==1);
+        assert(iStep == 1);
         uiSum += x265::primitives.satd[x265::PARTITION_8x4]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+        x264_cpu_emms();
 #else
         uiSum += xCalcHADs4x4(piOrg + 0, piCur, iStrideOrg, iStrideCur, iStep);
         uiSum += xCalcHADs4x4(piOrg + 4, piCur + 4 * iStep, iStrideOrg, iStrideCur, iStep);
@@ -2164,8 +2125,9 @@ UInt TComRdCost::xGetHADs8(DistParam* pc
         for (y = 0; y < iRows; y += 8)
         {
 #ifdef ENABLE_PRIMITIVES
-            assert(iStep==1);
+            assert(iStep == 1);
             uiSum += x265::primitives.sa8d_8x8((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur);
+            x264_cpu_emms();
 #else
             uiSum += xCalcHADs8x8(piOrg, piCur, iStrideOrg, iStrideCur, iStep);
 #endif
@@ -2183,7 +2145,6 @@ UInt TComRdCost::xGetHADs(DistParam* pcD
     {
         return xGetHADsw(pcDtParam);
     }
-
     Pel* piOrg   = pcDtParam->pOrg;
     Pel* piCur   = pcDtParam->pCur;
     Int  iRows   = pcDtParam->iRows;
@@ -2196,8 +2157,7 @@ UInt TComRdCost::xGetHADs(DistParam* pcD
     UInt uiSum = 0;
 
 #if NS_HAD
-    if (((iRows % 8 == 0) && (iCols % 8 == 0) &&
-         (iRows == iCols)) || ((iRows % 8 == 0) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD))
+    if (((iRows % 8 == 0) && (iCols % 8 == 0) && (iRows == iCols)) || ((iRows % 8 == 0) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD))
 #else
     if ((iRows % 8 == 0) && (iCols % 8 == 0))
 #endif
@@ -2209,8 +2169,9 @@ UInt TComRdCost::xGetHADs(DistParam* pcD
             for (x = 0; x < iCols; x += 8)
             {
 #ifdef ENABLE_PRIMITIVES
-                assert(iStep==1);
-                uiSum += x265::primitives.sa8d_8x8((pixel*)(&piOrg[x]), iStrideOrg, (pixel*)(&piCur[x*iStep]), iStrideCur);
+                assert(iStep == 1);
+                uiSum += x265::primitives.sa8d_8x8((pixel*)(&piOrg[x]), iStrideOrg, (pixel*)(&piCur[x * iStep]), iStrideCur);
+                x264_cpu_emms();
 #else
                 uiSum += xCalcHADs8x8(&piOrg[x], &piCur[x * iStep], iStrideOrg, iStrideCur, iStep);
 #endif
@@ -2220,7 +2181,6 @@ UInt TComRdCost::xGetHADs(DistParam* pcD
             piCur += iOffsetCur;
         }
     }
-
 #if NS_HAD
     else if ((iCols > 8) && (iCols > iRows) && pcDtParam->bUseNSHAD)
     {
@@ -2263,8 +2223,9 @@ UInt TComRdCost::xGetHADs(DistParam* pcD
             for (x = 0; x < iCols; x += 4)
             {
 #ifdef ENABLE_PRIMITIVES
-                assert(iStep==1);
-                uiSum += x265::primitives.satd[x265::PARTITION_4x4]((pixel*)(&piOrg[x]), iStrideOrg, (pixel*)(&piCur[x*iStep]), iStrideCur);
+                assert(iStep == 1);
+                uiSum += x265::primitives.satd[x265::PARTITION_4x4]((pixel*)(&piOrg[x]), iStrideOrg, (pixel*)(&piCur[x * iStep]), iStrideCur);
+                x264_cpu_emms();
 #else
                 uiSum += xCalcHADs4x4(&piOrg[x], &piCur[x * iStep], iStrideOrg, iStrideCur, iStep);
 #endif
--- a/source/Lib/TLibCommon/TComRdCost.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComRdCost.h	Tue Apr 23 11:07:40 2013 +0530
@@ -58,7 +58,7 @@ class TComPattern;
 // ====================================================================================================================
 
 // for function pointer
-typedef UInt (*FpDistFunc)(DistParam*);
+typedef UInt (*FpDistFunc) (DistParam*);
 
 // ====================================================================================================================
 // Class definition
@@ -159,18 +159,18 @@ public:
     Double  calcRdCost64(UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT);
 
 #if WEIGHTED_CHROMA_DISTORTION
-    Void    setCbDistortionWeight(Double cbDistortionWeight) { m_cbDistortionWeight = cbDistortionWeight;}
+    Void    setCbDistortionWeight(Double cbDistortionWeight) { m_cbDistortionWeight = cbDistortionWeight; }
 
-    Void    setCrDistortionWeight(Double crDistortionWeight) { m_crDistortionWeight = crDistortionWeight;}
+    Void    setCrDistortionWeight(Double crDistortionWeight) { m_crDistortionWeight = crDistortionWeight; }
 
 #endif
     Void    setLambda(Double dLambda);
-    Void    setFrameLambda(Double dLambda) { m_dFrameLambda = dLambda;}
+    Void    setFrameLambda(Double dLambda) { m_dFrameLambda = dLambda; }
 
-    Double  getSqrtLambda()   { return m_sqrtLambda;}
+    Double  getSqrtLambda()   { return m_sqrtLambda; }
 
 #if RATE_CONTROL_LAMBDA_DOMAIN
-    Double  getLambda() { return m_dLambda;}
+    Double  getLambda() { return m_dLambda; }
 
 #endif
 
@@ -180,40 +180,12 @@ public:
     Void    setDistParam(UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc, DistParam& rcDistParam);
     Void    setDistParam(TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride,            DistParam& rcDistParam);
 #if NS_HAD
-    Void    setDistParam(TComPattern* pcPatternKey,
-                         Pel*         piRefY,
-                         Int          iRefStride,
-                         Int          iStep,
-                         DistParam&   rcDistParam,
-                         Bool         bHADME = false,
-                         Bool         bUseNSHAD = false);
-    Void    setDistParam(DistParam& rcDP,
-                         Int        bitDepth,
-                         Pel*       p1,
-                         Int        iStride1,
-                         Pel*       p2,
-                         Int        iStride2,
-                         Int        iWidth,
-                         Int        iHeight,
-                         Bool       bHadamard = false,
-                         Bool       bUseNSHAD = false);
-#else // if NS_HAD
-    Void    setDistParam(TComPattern* pcPatternKey,
-                         Pel*         piRefY,
-                         Int          iRefStride,
-                         Int          iStep,
-                         DistParam&   rcDistParam,
-                         Bool         bHADME = false);
-    Void    setDistParam(DistParam& rcDP,
-                         Int        bitDepth,
-                         Pel*       p1,
-                         Int        iStride1,
-                         Pel*       p2,
-                         Int        iStride2,
-                         Int        iWidth,
-                         Int        iHeight,
-                         Bool       bHadamard = false);
-#endif // if NS_HAD
+    Void    setDistParam(TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME = false, Bool bUseNSHAD = false);
+    Void    setDistParam(DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false, Bool bUseNSHAD = false);
+#else
+    Void    setDistParam(TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME = false);
+    Void    setDistParam(DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false);
+#endif
 
     UInt    calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight);
 
@@ -223,7 +195,7 @@ public:
     Void    xUninit();
 #endif
     UInt    xGetComponentBits(Int iVal);
-    Void    getMotionCost(Bool bSad, Int iAdd) { m_uiCost = (bSad ? m_uiLambdaMotionSAD + iAdd : m_uiLambdaMotionSSE + iAdd);}
+    Void    getMotionCost(Bool bSad, Int iAdd) { m_uiCost = (bSad ? m_uiLambdaMotionSAD + iAdd : m_uiLambdaMotionSSE + iAdd); }
 
     Void    setPredictor(TComMv& rcMv)
     {
@@ -235,7 +207,7 @@ public:
 #endif
     }
 
-    Void    setCostScale(Int iCostScale)    { m_iCostScale = iCostScale;}
+    Void    setCostScale(Int iCostScale)    { m_iCostScale = iCostScale; }
 
     __inline UInt getCost(Int x, Int y)
     {
@@ -246,7 +218,7 @@ public:
 #endif
     }
 
-    UInt    getCost(UInt b)                 { return (m_uiCost * b) >> 16;}
+    UInt    getCost(UInt b)                 { return (m_uiCost * b) >> 16; }
 
     UInt    getBits(Int x, Int y)
     {
@@ -297,25 +269,10 @@ private:
 public:
 
 #if WEIGHTED_CHROMA_DISTORTION
-    UInt   getDistPart(Int      bitDepth,
-                       Pel*     piCur,
-                       Int      iCurStride,
-                       Pel*     piOrg,
-                       Int      iOrgStride,
-                       UInt     uiBlkWidth,
-                       UInt     uiBlkHeight,
-                       TextType eText = TEXT_LUMA,
-                       DFunc    eDFunc = DF_SSE);
+    UInt   getDistPart(Int bitDepth, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, TextType eText = TEXT_LUMA, DFunc eDFunc = DF_SSE);
 #else
-    UInt   getDistPart(Int   bitDepth,
-                       Pel*  piCur,
-                       Int   iCurStride,
-                       Pel*  piOrg,
-                       Int   iOrgStride,
-                       UInt  uiBlkWidth,
-                       UInt  uiBlkHeight,
-                       DFunc eDFunc = DF_SSE);
-#endif // if WEIGHTED_CHROMA_DISTORTION
+    UInt   getDistPart(Int bitDepth, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_SSE);
+#endif
 
 #if RATE_CONTROL_LAMBDA_DOMAIN
     UInt   getSADPart(Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height);
--- a/source/Lib/TLibCommon/TComRom.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComRom.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -217,70 +217,38 @@ const Short g_aiT16[16][16] =
 
 const Short g_aiT32[32][32] =
 {
-    { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-      64 },
-    { 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13,  4, -4, -13, -22, -31, -38, -46, -54, -61, -67, -73, -78, -82,
-      -85, -88, -90, -90 },
-    { 90, 87, 80, 70, 57, 43, 25,  9, -9, -25, -43, -57, -70, -80, -87, -90, -90, -87, -80, -70, -57, -43, -25, -9,  9, 25, 43,
-      57, 70, 80, 87, 90 },
-    { 90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13, 13, 38, 61, 78, 88, 90, 85, 73, 54, 31,  4, -22,
-      -46, -67, -82, -90 },
-    { 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89, 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50,
-      -18, 18, 50, 75, 89 },
-    { 88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22, -22, -61, -85, -90, -73, -38,  4, 46, 78, 90, 82, 54,
-      13, -31, -67, -88 },
-    { 87, 57,  9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87, -87, -57, -9, 43, 80, 90, 70, 25, -25, -70, -90, -80,
-      -43,  9, 57, 87 },
-    { 85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31, 31, 78, 90, 61,  4, -54, -88, -82, -38, 22, 73, 90,
-      67, 13, -46, -85 },
-    { 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36,
-      -83, -83, -36, 36, 83 },
-    { 82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67,  4, 73, 88, 38, -38, -88, -73, -4, 67, 90, 46, -31, -85, -78, -13, 61,
-      90, 54, -22, -82 },
-    { 80,  9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80, -80, -9, 70, 87, 25, -57, -90, -43, 43, 90, 57, -25,
-      -87, -70,  9, 80 },
-    { 78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46, 46, 90, 38, -54, -90, -31, 61, 88, 22, -67, -85,
-      -13, 73, 82,  4, -78 },
-    { 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75, 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50,
-      -50, -89, -18, 75 },
-    { 73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54, -54, -85,  4, 88, 46, -61, -82, 13, 90, 38, -67,
-      -78, 22, 90, 31, -73 },
-    { 70, -43, -87,  9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70, -70, 43, 87, -9, -90, -25, 80, 57, -57, -80, 25, 90,
-      9, -87, -43, 70 },
-    { 67, -54, -78, 38, 85, -22, -90,  4, 90, 13, -88, -31, 82, 46, -73, -61, 61, 73, -46, -82, 31, 88, -13, -90, -4, 90, 22, -85,
-      -38, 78, 54, -67 },
-    { 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64,
-      64, 64, -64, -64, 64 },
-    { 61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67, -67, -54, 78, 38, -85, -22, 90,  4, -90, 13, 88, -31,
-      -82, 46, 73, -61 },
-    { 57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87,  9, -90, 25, 80, -57, -57, 80, 25, -90,  9, 87, -43, -70, 70, 43, -87, -9,
-      90, -25, -80, 57 },
-    { 54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73, 73, 31, -90, 22, 78, -67, -38, 90, -13, -82, 61, 46,
-      -88,  4, 85, -54 },
-    { 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50, 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18,
-      -75, 75, 18, -89, 50 },
-    { 46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82,  4, 78, -78, -4, 82, -73, -13, 85, -67, -22, 88, -61, -31, 90,
-      -54, -38, 90, -46 },
-    { 43, -90, 57, 25, -87, 70,  9, -80, 80, -9, -70, 87, -25, -57, 90, -43, -43, 90, -57, -25, 87, -70, -9, 80, -80,  9, 70, -87,
-      25, 57, -90, 43 },
-    { 38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82, 82, -22, -54, 90, -61, -13, 78, -85, 31, 46, -90, 67,
-      4, -73, 88, -38 },
-    { 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83,
-      -36, -36, 83, -83, 36 },
-    { 31, -78, 90, -61,  4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85, -85, 46, 13, -67, 90, -73, 22, 38, -82, 88, -54, -4,
-      61, -90, 78, -31 },
-    { 25, -70, 90, -80, 43,  9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25, -25, 70, -90, 80, -43, -9, 57, -87, 87, -57,  9, 43,
-      -80, 90, -70, 25 },
-    { 22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88, 88, -67, 31, 13, -54, 82, -90, 78, -46,  4, 38, -73,
-      90, -85, 61, -22 },
-    { 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18, 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75,
-      89, -89, 75, -50, 18 },
-    { 13, -38, 61, -78, 88, -90, 85, -73, 54, -31,  4, 22, -46, 67, -82, 90, -90, 82, -67, 46, -22, -4, 31, -54, 73, -85, 90, -88,
-      78, -61, 38, -13 },
-    {  9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9, -9, 25, -43, 57, -70, 80, -87, 90, -90, 87, -80, 70,
-       -57, 43, -25,  9 },
-    {  4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90, 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46,
-       -38, 31, -22, 13, -4 }
+    { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
+    { 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13,  4, -4, -13, -22, -31, -38, -46, -54, -61, -67, -73, -78, -82, -85, -88, -90, -90 },
+    { 90, 87, 80, 70, 57, 43, 25,  9, -9, -25, -43, -57, -70, -80, -87, -90, -90, -87, -80, -70, -57, -43, -25, -9,  9, 25, 43, 57, 70, 80, 87, 90 },
+    { 90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13, 13, 38, 61, 78, 88, 90, 85, 73, 54, 31,  4, -22, -46, -67, -82, -90 },
+    { 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89, 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89 },
+    { 88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22, -22, -61, -85, -90, -73, -38,  4, 46, 78, 90, 82, 54, 13, -31, -67, -88 },
+    { 87, 57,  9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87, -87, -57, -9, 43, 80, 90, 70, 25, -25, -70, -90, -80, -43,  9, 57, 87 },
+    { 85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31, 31, 78, 90, 61,  4, -54, -88, -82, -38, 22, 73, 90, 67, 13, -46, -85 },
+    { 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83 },
+    { 82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67,  4, 73, 88, 38, -38, -88, -73, -4, 67, 90, 46, -31, -85, -78, -13, 61, 90, 54, -22, -82 },
+    { 80,  9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80, -80, -9, 70, 87, 25, -57, -90, -43, 43, 90, 57, -25, -87, -70,  9, 80 },
+    { 78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46, 46, 90, 38, -54, -90, -31, 61, 88, 22, -67, -85, -13, 73, 82,  4, -78 },
+    { 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75, 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75 },
+    { 73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54, -54, -85,  4, 88, 46, -61, -82, 13, 90, 38, -67, -78, 22, 90, 31, -73 },
+    { 70, -43, -87,  9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70, -70, 43, 87, -9, -90, -25, 80, 57, -57, -80, 25, 90,  9, -87, -43, 70 },
+    { 67, -54, -78, 38, 85, -22, -90,  4, 90, 13, -88, -31, 82, 46, -73, -61, 61, 73, -46, -82, 31, 88, -13, -90, -4, 90, 22, -85, -38, 78, 54, -67 },
+    { 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64 },
+    { 61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67, -67, -54, 78, 38, -85, -22, 90,  4, -90, 13, 88, -31, -82, 46, 73, -61 },
+    { 57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87,  9, -90, 25, 80, -57, -57, 80, 25, -90,  9, 87, -43, -70, 70, 43, -87, -9, 90, -25, -80, 57 },
+    { 54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73, 73, 31, -90, 22, 78, -67, -38, 90, -13, -82, 61, 46, -88,  4, 85, -54 },
+    { 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50, 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50 },
+    { 46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82,  4, 78, -78, -4, 82, -73, -13, 85, -67, -22, 88, -61, -31, 90, -54, -38, 90, -46 },
+    { 43, -90, 57, 25, -87, 70,  9, -80, 80, -9, -70, 87, -25, -57, 90, -43, -43, 90, -57, -25, 87, -70, -9, 80, -80,  9, 70, -87, 25, 57, -90, 43 },
+    { 38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82, 82, -22, -54, 90, -61, -13, 78, -85, 31, 46, -90, 67,  4, -73, 88, -38 },
+    { 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36 },
+    { 31, -78, 90, -61,  4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85, -85, 46, 13, -67, 90, -73, 22, 38, -82, 88, -54, -4, 61, -90, 78, -31 },
+    { 25, -70, 90, -80, 43,  9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25, -25, 70, -90, 80, -43, -9, 57, -87, 87, -57,  9, 43, -80, 90, -70, 25 },
+    { 22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88, 88, -67, 31, 13, -54, 82, -90, 78, -46,  4, 38, -73, 90, -85, 61, -22 },
+    { 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18, 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18 },
+    { 13, -38, 61, -78, 88, -90, 85, -73, 54, -31,  4, 22, -46, 67, -82, 90, -90, 82, -67, 46, -22, -4, 31, -54, 73, -85, 90, -88, 78, -61, 38, -13 },
+    {  9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9, -9, 25, -43, 57, -70, 80, -87, 90, -90, 87, -80, 70, -57, 43, -25,  9 },
+    {  4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90, 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46, -38, 31, -22, 13, -4 }
 };
 
 const UChar g_aucChromaScale[58] =
@@ -397,7 +365,6 @@ Void initSigLastScan(UInt* pBuffD, UInt*
         {
             pBuffTemp = g_sigLastScanCG32x32;
         }
-
         for (UInt uiScanLine = 0; uiNextScanPos < uiNumScanPos; uiScanLine++)
         {
             Int    iPrimDim  = Int(uiScanLine);
@@ -417,7 +384,6 @@ Void initSigLastScan(UInt* pBuffD, UInt*
             }
         }
     }
-
     if (iWidth > 4)
     {
         UInt uiNumBlkSide = iWidth >> 2;
@@ -432,7 +398,6 @@ Void initSigLastScan(UInt* pBuffD, UInt*
             {
                 initBlkPos = g_sigLastScanCG32x32[uiBlk];
             }
-
             UInt offsetY    = initBlkPos / uiNumBlkSide;
             UInt offsetX    = initBlkPos - offsetY * uiNumBlkSide;
             UInt offsetD    = 4 * (offsetX + offsetY * iWidth);
--- a/source/Lib/TLibCommon/TComRom.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComRom.h	Tue Apr 23 11:07:40 2013 +0530
@@ -175,33 +175,13 @@ extern UInt64 g_nSymbolCounter;
 #define COUNTER_START    1
 #define COUNTER_END      0 //( UInt64(1) << 63 )
 
-#define DTRACE_CABAC_F(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            "%f", \
-            x);
-#define DTRACE_CABAC_V(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            "%d", \
-            x);
-#define DTRACE_CABAC_VL(x)    if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            "%lld", \
-            x);
-#define DTRACE_CABAC_T(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            "%s", \
-            x);
-#define DTRACE_CABAC_X(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            "%x", \
-            x);
-#define DTRACE_CABAC_R(x, y) if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            x, \
-            y);
-#define DTRACE_CABAC_N        if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf( \
-            g_hTrace, \
-            "\n");
+#define DTRACE_CABAC_F(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, "%f", x);
+#define DTRACE_CABAC_V(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, "%d", x);
+#define DTRACE_CABAC_VL(x)    if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, "%lld", x);
+#define DTRACE_CABAC_T(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, "%s", x);
+#define DTRACE_CABAC_X(x)     if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, "%x", x);
+#define DTRACE_CABAC_R(x, y) if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, x,    y);
+#define DTRACE_CABAC_N        if ((g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END) || g_bJustDoIt) fprintf(g_hTrace, "\n");
 
 #else // if ENC_DEC_TRACE
 
--- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -50,7 +50,7 @@ SAOParam::~SAOParam()
     {
         if (psSaoPart[i])
         {
-            delete[] psSaoPart[i];
+            delete [] psSaoPart[i];
         }
     }
 }
@@ -143,7 +143,6 @@ Int  TComSampleAdaptiveOffset::convertLe
     {
         idx = 85 + row * 16 + col;
     }
-
     return idx;
 }
 
@@ -264,16 +263,14 @@ Void TComSampleAdaptiveOffset::destroy()
 {
     if (m_pClipTableBase)
     {
-        delete[] m_pClipTableBase;
+        delete [] m_pClipTableBase;
         m_pClipTableBase = NULL;
     }
-
     if (m_iOffsetBo)
     {
-        delete[] m_iOffsetBo;
+        delete [] m_iOffsetBo;
         m_iOffsetBo = NULL;
     }
-
     if (m_lumaTableBo)
     {
         delete[] m_lumaTableBo;
@@ -282,16 +279,14 @@ Void TComSampleAdaptiveOffset::destroy()
 
     if (m_pChromaClipTableBase)
     {
-        delete[] m_pChromaClipTableBase;
+        delete [] m_pChromaClipTableBase;
         m_pChromaClipTableBase = NULL;
     }
-
     if (m_iChromaOffsetBo)
     {
-        delete[] m_iChromaOffsetBo;
+        delete [] m_iChromaOffsetBo;
         m_iChromaOffsetBo = NULL;
     }
-
     if (m_chromaTableBo)
     {
         delete[] m_chromaTableBo;
@@ -301,45 +296,39 @@ Void TComSampleAdaptiveOffset::destroy()
     if (m_iUpBuff1)
     {
         m_iUpBuff1--;
-        delete[] m_iUpBuff1;
+        delete [] m_iUpBuff1;
         m_iUpBuff1 = NULL;
     }
-
     if (m_iUpBuff2)
     {
         m_iUpBuff2--;
-        delete[] m_iUpBuff2;
+        delete [] m_iUpBuff2;
         m_iUpBuff2 = NULL;
     }
-
     if (m_iUpBufft)
     {
         m_iUpBufft--;
-        delete[] m_iUpBufft;
+        delete [] m_iUpBufft;
         m_iUpBufft = NULL;
     }
-
     if (m_pTmpL1)
     {
-        delete[] m_pTmpL1;
+        delete [] m_pTmpL1;
         m_pTmpL1 = NULL;
     }
-
     if (m_pTmpL2)
     {
-        delete[] m_pTmpL2;
+        delete [] m_pTmpL2;
         m_pTmpL2 = NULL;
     }
-
     if (m_pTmpU1)
     {
-        delete[] m_pTmpU1;
+        delete [] m_pTmpU1;
         m_pTmpU1 = NULL;
     }
-
     if (m_pTmpU2)
     {
-        delete[] m_pTmpU2;
+        delete [] m_pTmpU2;
         m_pTmpU2 = NULL;
     }
 }
@@ -366,16 +355,7 @@ Void TComSampleAdaptiveOffset::allocSaoP
 /** initialize SAO parameters
  * \param    *pcSaoParam,  iPartLevel,  iPartRow,  iPartCol,  iParentPartIdx,  StartCUX,  EndCUX,  StartCUY,  EndCUY,  iYCbCr
  */
-Void TComSampleAdaptiveOffset::initSAOParam(SAOParam *pcSaoParam,
-                                            Int       iPartLevel,
-                                            Int       iPartRow,
-                                            Int       iPartCol,
-                                            Int       iParentPartIdx,
-                                            Int       StartCUX,
-                                            Int       EndCUX,
-                                            Int       StartCUY,
-                                            Int       EndCUY,
-                                            Int       iYCbCr)
+Void TComSampleAdaptiveOffset::initSAOParam(SAOParam *pcSaoParam, Int iPartLevel, Int iPartRow, Int iPartCol, Int iParentPartIdx, Int StartCUX, Int EndCUX, Int StartCUY, Int EndCUY, Int iYCbCr)
 {
     Int j;
     Int iPartIdx = convertLevelRowCol2Idx(iPartLevel, iPartRow, iPartCol);
@@ -433,16 +413,7 @@ Void TComSampleAdaptiveOffset::initSAOPa
 
         pSaoPart->DownPartsIdx[0] = convertLevelRowCol2Idx(DownLevel, iDownRowIdx, iDownColIdx);
 
-        initSAOParam(pcSaoParam,
-                     DownLevel,
-                     iDownRowIdx,
-                     iDownColIdx,
-                     iPartIdx,
-                     DownStartCUX,
-                     DownEndCUX,
-                     DownStartCUY,
-                     DownEndCUY,
-                     iYCbCr);
+        initSAOParam(pcSaoParam, DownLevel, iDownRowIdx, iDownColIdx, iPartIdx, DownStartCUX, DownEndCUX, DownStartCUY, DownEndCUY, iYCbCr);
 
         DownStartCUX = StartCUX + NumCULeft;
         DownEndCUX   = EndCUX;
@@ -453,16 +424,7 @@ Void TComSampleAdaptiveOffset::initSAOPa
 
         pSaoPart->DownPartsIdx[1] = convertLevelRowCol2Idx(DownLevel, iDownRowIdx, iDownColIdx);
 
-        initSAOParam(pcSaoParam,
-                     DownLevel,
-                     iDownRowIdx,
-                     iDownColIdx,
-                     iPartIdx,
-                     DownStartCUX,
-                     DownEndCUX,
-                     DownStartCUY,
-                     DownEndCUY,
-                     iYCbCr);
+        initSAOParam(pcSaoParam, DownLevel, iDownRowIdx, iDownColIdx, iPartIdx,  DownStartCUX, DownEndCUX, DownStartCUY, DownEndCUY, iYCbCr);
 
         DownStartCUX = StartCUX;
         DownEndCUX   = DownStartCUX + NumCULeft - 1;
@@ -473,16 +435,7 @@ Void TComSampleAdaptiveOffset::initSAOPa
 
         pSaoPart->DownPartsIdx[2] = convertLevelRowCol2Idx(DownLevel, iDownRowIdx, iDownColIdx);
 
-        initSAOParam(pcSaoParam,
-                     DownLevel,
-                     iDownRowIdx,
-                     iDownColIdx,
-                     iPartIdx,
-                     DownStartCUX,
-                     DownEndCUX,
-                     DownStartCUY,
-                     DownEndCUY,
-                     iYCbCr);
+        initSAOParam(pcSaoParam, DownLevel, iDownRowIdx, iDownColIdx, iPartIdx, DownStartCUX, DownEndCUX, DownStartCUY, DownEndCUY, iYCbCr);
 
         DownStartCUX = StartCUX + NumCULeft;
         DownEndCUX   = EndCUX;
@@ -493,16 +446,7 @@ Void TComSampleAdaptiveOffset::initSAOPa
 
         pSaoPart->DownPartsIdx[3] = convertLevelRowCol2Idx(DownLevel, iDownRowIdx, iDownColIdx);
 
-        initSAOParam(pcSaoParam,
-                     DownLevel,
-                     iDownRowIdx,
-                     iDownColIdx,
-                     iPartIdx,
-                     DownStartCUX,
-                     DownEndCUX,
-                     DownStartCUY,
-                     DownEndCUY,
-                     iYCbCr);
+        initSAOParam(pcSaoParam, DownLevel, iDownRowIdx, iDownColIdx, iPartIdx, DownStartCUX, DownEndCUX, DownStartCUY, DownEndCUY, iYCbCr);
     }
     else
     {
@@ -515,27 +459,25 @@ Void TComSampleAdaptiveOffset::initSAOPa
  */
 Void TComSampleAdaptiveOffset::freeSaoParam(SAOParam *pcSaoParam)
 {
-    delete[] pcSaoParam->psSaoPart[0];
-    delete[] pcSaoParam->psSaoPart[1];
-    delete[] pcSaoParam->psSaoPart[2];
+    delete [] pcSaoParam->psSaoPart[0];
+    delete [] pcSaoParam->psSaoPart[1];
+    delete [] pcSaoParam->psSaoPart[2];
     pcSaoParam->psSaoPart[0] = 0;
     pcSaoParam->psSaoPart[1] = 0;
     pcSaoParam->psSaoPart[2] = 0;
     if (pcSaoParam->saoLcuParam[0])
     {
-        delete[] pcSaoParam->saoLcuParam[0];
+        delete [] pcSaoParam->saoLcuParam[0];
         pcSaoParam->saoLcuParam[0] = NULL;
     }
-
     if (pcSaoParam->saoLcuParam[1])
     {
-        delete[] pcSaoParam->saoLcuParam[1];
+        delete [] pcSaoParam->saoLcuParam[1];
         pcSaoParam->saoLcuParam[1] = NULL;
     }
-
     if (pcSaoParam->saoLcuParam[2])
     {
-        delete[] pcSaoParam->saoLcuParam[2];
+        delete [] pcSaoParam->saoLcuParam[2];
         pcSaoParam->saoLcuParam[2] = NULL;
     }
 }
@@ -553,7 +495,6 @@ Void TComSampleAdaptiveOffset::resetSAOP
         {
             pcSaoParam->bSaoFlag[c] = 0;
         }
-
         for (Int i = 0; i < m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; i++)
         {
             pcSaoParam->psSaoPart[c][i].iBestType     = -1;
@@ -654,14 +595,7 @@ Void TComSampleAdaptiveOffset::processSa
  * \param  height block height
  * \param  pbBorderAvail availabilities of block border pixels
  */
-Void TComSampleAdaptiveOffset::processSaoBlock(Pel*  pDec,
-                                               Pel*  pRest,
-                                               Int   stride,
-                                               Int   saoType,
-                                               UInt  width,
-                                               UInt  height,
-                                               Bool* pbBorderAvail,
-                                               Int   iYCbCr)
+Void TComSampleAdaptiveOffset::processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int saoType, UInt width, UInt height, Bool* pbBorderAvail, Int iYCbCr)
 {
     //variables
     Int startX, startY, endX, endY, x, y;
@@ -703,7 +637,6 @@ Void TComSampleAdaptiveOffset::processSa
             pDec  += stride;
             pRest += stride;
         }
-
         for (x = 0; x < width; x++)
         {
             m_iUpBuff1[x] = xSign(pDec[x] - pDec[x - stride]);
@@ -748,7 +681,6 @@ Void TComSampleAdaptiveOffset::processSa
             edgeType      =  xSign(pDec[x] - pDec[x - posShift]) - m_iUpBuff1[x + 1] + 2;
             pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
         }
-
         if (pbBorderAvail[SGU_T])
         {
             for (x = 1; x < endX; x++)
@@ -757,7 +689,6 @@ Void TComSampleAdaptiveOffset::processSa
                 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
             }
         }
-
         pDec   += stride;
         pRest  += stride;
 
@@ -792,14 +723,12 @@ Void TComSampleAdaptiveOffset::processSa
                 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
             }
         }
-
         if (pbBorderAvail[SGU_BR])
         {
             x = width - 1;
             edgeType =  xSign(pDec[x] - pDec[x + posShift]) + m_iUpBuff1[x] + 2;
             pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
         }
-
         break;
     }
     case SAO_EO_3: // dir: 45
@@ -825,14 +754,12 @@ Void TComSampleAdaptiveOffset::processSa
                 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
             }
         }
-
         if (pbBorderAvail[SGU_TR])
         {
             x = width - 1;
             edgeType = xSign(pDec[x] - pDec[x - posShift]) - m_iUpBuff1[x - 1] + 2;
             pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
         }
-
         pDec  += stride;
         pRest += stride;
 
@@ -861,7 +788,6 @@ Void TComSampleAdaptiveOffset::processSa
             edgeType = xSign(pDec[x] - pDec[x + posShift]) + m_iUpBuff1[x] + 2;
             pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
         }
-
         if (pbBorderAvail[SGU_B])
         {
             for (x = 1; x < endX; x++)
@@ -870,7 +796,6 @@ Void TComSampleAdaptiveOffset::processSa
                 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]];
             }
         }
-
         break;
     }
     case SAO_BO:
@@ -945,7 +870,6 @@ Void TComSampleAdaptiveOffset::processSa
     {
         return;
     }
-
     if (iYCbCr == 0)
     {
         pRec       = m_pcPic->getPicYuvRec()->getLumaAddr(iAddr);
@@ -1012,7 +936,6 @@ Void TComSampleAdaptiveOffset::processSa
         {
             pRec += iStride;
         }
-
         for (x = 0; x < iLcuWidth; x++)
         {
             m_iUpBuff1[x] = xSign(pRec[x] - pTmpU[x]);
@@ -1152,14 +1075,12 @@ Void TComSampleAdaptiveOffset::SAOProces
         {
             m_pcPic->getPicYuvRec()->copyToPic(m_pcYuvTmp);
         }
-
         if (m_saoLcuBasedOptimization)
         {
             pcSaoParam->oneUnitFlag[0] = 0;
             pcSaoParam->oneUnitFlag[1] = 0;
             pcSaoParam->oneUnitFlag[2] = 0;
         }
-
         Int iY  = 0;
         {
             processSaoUnitAll(pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY);
@@ -1288,7 +1209,6 @@ Void TComSampleAdaptiveOffset::processSa
                 typeIdx = saoLcuParam[addr].typeIdx;
                 mergeLeftFlag = saoLcuParam[addr].mergeLeftFlag;
             }
-
             if (typeIdx >= 0)
             {
                 if (!mergeLeftFlag)
@@ -1302,8 +1222,7 @@ Void TComSampleAdaptiveOffset::processSa
 
                         for (i = 0; i < saoLcuParam[addr].length; i++)
                         {
-                            offset[(saoLcuParam[addr].subTypeIdx +
-                                    i) % SAO_MAX_BO_CLASSES  + 1] = saoLcuParam[addr].offset[i] << saoBitIncrease;
+                            offset[(saoLcuParam[addr].subTypeIdx + i) % SAO_MAX_BO_CLASSES  + 1] = saoLcuParam[addr].offset[i] << saoBitIncrease;
                         }
 
                         ppLumaTable = (yCbCr == 0) ? m_lumaTableBo : m_chromaTableBo;
@@ -1315,7 +1234,6 @@ Void TComSampleAdaptiveOffset::processSa
                             pOffsetBo[i] = pClipTable[i + offset[ppLumaTable[i]]];
                         }
                     }
-
                     if (typeIdx == SAO_EO_0 || typeIdx == SAO_EO_1 || typeIdx == SAO_EO_2 || typeIdx == SAO_EO_3)
                     {
                         for (i = 0; i < saoLcuParam[addr].length; i++)
@@ -1329,7 +1247,6 @@ Void TComSampleAdaptiveOffset::processSa
                         }
                     }
                 }
-
                 processSaoCu(addr, typeIdx, yCbCr);
             }
             else
@@ -1351,7 +1268,6 @@ Void TComSampleAdaptiveOffset::processSa
                         pRec  = m_pcPic->getPicYuvRec()->getCrAddr(addr);
                         stride = m_pcPic->getCStride();
                     }
-
                     Int widthShift = m_uiMaxCUWidth >> isChroma;
                     for (i = 0; i < (m_uiMaxCUHeight >> isChroma) + 1; i++)
                     {
@@ -1505,8 +1421,7 @@ Void TComSampleAdaptiveOffset::PCMLFDisa
  */
 Void TComSampleAdaptiveOffset::xPCMRestoration(TComPic* pcPic)
 {
-    Bool  bPCMFilter =
-        (pcPic->getSlice(0)->getSPS()->getUsePCM() && pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag()) ? true : false;
+    Bool  bPCMFilter = (pcPic->getSlice(0)->getSPS()->getUsePCM() && pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag()) ? true : false;
 
     if (bPCMFilter || pcPic->getSlice(0)->getPPS()->getTransquantBypassEnableFlag())
     {
@@ -1538,8 +1453,7 @@ Void TComSampleAdaptiveOffset::xPCMCURes
         {
             UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiAbsZorderIdx]];
             UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiAbsZorderIdx]];
-            if ((uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples()) &&
-                (uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()))
+            if ((uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples()) && (uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()))
                 xPCMCURestoration(pcCU, uiAbsZorderIdx, uiDepth + 1);
         }
 
@@ -1547,8 +1461,7 @@ Void TComSampleAdaptiveOffset::xPCMCURes
     }
 
     // restore PCM samples
-    if ((pcCU->getIPCMFlag(uiAbsZorderIdx) &&
-         pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag()) || pcCU->isLosslessCoded(uiAbsZorderIdx))
+    if ((pcCU->getIPCMFlag(uiAbsZorderIdx) && pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag()) || pcCU->isLosslessCoded(uiAbsZorderIdx))
     {
         xPCMSampleRestoration(pcCU, uiAbsZorderIdx, uiDepth, TEXT_LUMA);
         xPCMSampleRestoration(pcCU, uiAbsZorderIdx, uiDepth, TEXT_CHROMA_U);
--- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h	Tue Apr 23 11:07:40 2013 +0530
@@ -120,16 +120,7 @@ public:
 
     Int  convertLevelRowCol2Idx(Int level, Int row, Int col);
 
-    Void initSAOParam(SAOParam *pcSaoParam,
-                      Int       iPartLevel,
-                      Int       iPartRow,
-                      Int       iPartCol,
-                      Int       iParentPartIdx,
-                      Int       StartCUX,
-                      Int       EndCUX,
-                      Int       StartCUY,
-                      Int       EndCUY,
-                      Int       iYCbCr);
+    Void initSAOParam(SAOParam *pcSaoParam, Int iPartLevel, Int iPartRow, Int iPartCol, Int iParentPartIdx, Int StartCUX, Int EndCUX, Int StartCUY, Int EndCUY, Int iYCbCr);
     Void allocSaoParam(SAOParam* pcSaoParam);
     Void resetSAOParam(SAOParam *pcSaoParam);
     static Void freeSaoParam(SAOParam *pcSaoParam);
@@ -141,26 +132,19 @@ public:
     Void processSaoCuOrg(Int iAddr, Int iPartIdx, Int iYCbCr); //!< LCU-basd SAO process without slice granularity
     Void createPicSaoInfo(TComPic* pcPic);
     Void destroyPicSaoInfo();
-    Void processSaoBlock(Pel*  pDec,
-                         Pel*  pRest,
-                         Int   stride,
-                         Int   iSaoType,
-                         UInt  width,
-                         UInt  height,
-                         Bool* pbBorderAvail,
-                         Int   iYCbCr);
+    Void processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int iSaoType, UInt width, UInt height, Bool* pbBorderAvail, Int iYCbCr);
 
     Void resetLcuPart(SaoLcuParam* saoLcuParam);
     Void convertQT2SaoUnit(SAOParam* saoParam, UInt partIdx, Int yCbCr);
     Void convertOnePart2SaoUnit(SAOParam *saoParam, UInt partIdx, Int yCbCr);
     Void processSaoUnitAll(SaoLcuParam* saoLcuParam, Bool oneUnitFlag, Int yCbCr);
-    Void setSaoLcuBoundary(Bool bVal)  { m_saoLcuBoundary = bVal;}
+    Void setSaoLcuBoundary(Bool bVal)  { m_saoLcuBoundary = bVal; }
 
-    Bool getSaoLcuBoundary()           { return m_saoLcuBoundary;}
+    Bool getSaoLcuBoundary()           { return m_saoLcuBoundary; }
 
-    Void setSaoLcuBasedOptimization(Bool bVal)  { m_saoLcuBasedOptimization = bVal;}
+    Void setSaoLcuBasedOptimization(Bool bVal)  { m_saoLcuBasedOptimization = bVal; }
 
-    Bool getSaoLcuBasedOptimization()           { return m_saoLcuBasedOptimization;}
+    Bool getSaoLcuBasedOptimization()           { return m_saoLcuBasedOptimization; }
 
     Void resetSaoUnit(SaoLcuParam* saoUnit);
     Void copySaoUnit(SaoLcuParam* saoUnitDst, SaoLcuParam* saoUnitSrc);
--- a/source/Lib/TLibCommon/TComSlice.cpp	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp	Tue Apr 23 11:07:40 2013 +0530
@@ -58,8 +58,10 @@ TComSlice::TComSlice()
     , m_deblockingFilterOverrideFlag(false)
     , m_deblockingFilterBetaOffsetDiv2(0)
     , m_deblockingFilterTcOffsetDiv2(0)
+#if !L0034_COMBINED_LIST_CLEANUP
     , m_bRefPicListModificationFlagLC(false)
     , m_bRefPicListCombinationFlag(false)
+#endif
     , m_bCheckLDC(false)
     , m_iSliceQpDelta(0)
     , m_iSliceQpDeltaCb(0)
@@ -77,7 +79,9 @@ TComSlice::TComSlice()
 #else
     , m_dLambda(0.0)
 #endif
+#if !L0034_COMBINED_LIST_CLEANUP
     , m_bNoBackPredFlag(false)
+#endif
     , m_uiTLayer(0)
     , m_bTLayerSwitchingFlag(false)
     , m_sliceMode(0)
@@ -102,10 +106,21 @@ TComSlice::TComSlice()
     , m_temporalLayerNonReferenceFlag(false)
     , m_enableTMVPFlag(true)
 {
+#if L0034_COMBINED_LIST_CLEANUP
+    m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
+#else
     m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
+#endif
 
     initEqualRef();
 
+#if L0034_COMBINED_LIST_CLEANUP
+    for (Int idx = 0; idx < MAX_NUM_REF; idx++)
+    {
+        m_list1IdxToList0Idx[idx] = -1;
+    }
+
+#else
     for (Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
     {
         m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount] = -1;
@@ -116,6 +131,7 @@ TComSlice::TComSlice()
         m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
     }
 
+#endif // if L0034_COMBINED_LIST_CLEANUP
     for (Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
     {
         m_apcRefPicList[0][iNumCount] = NULL;
@@ -144,14 +160,18 @@ Void TComSlice::initSlice()
 
     m_colRefIdx = 0;
     initEqualRef();
+#if !L0034_COMBINED_LIST_CLEANUP
     m_bNoBackPredFlag = false;
     m_bRefPicListCombinationFlag = false;
     m_bRefPicListModificationFlagLC = false;
+#endif
     m_bCheckLDC = false;
     m_iSliceQpDeltaCb = 0;
     m_iSliceQpDeltaCr = 0;
 
+#if !L0034_COMBINED_LIST_CLEANUP
     m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
+#endif
 
     m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
 
@@ -237,7 +257,6 @@ TComPic* TComSlice::xGetRefPic(TComList<
         {
             break;
         }
-
         iterPic++;
         pcPic = *(iterPic);
     }
@@ -245,27 +264,41 @@ TComPic* TComSlice::xGetRefPic(TComList<
     return pcPic;
 }
 
-TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic,
-                                       Int                 poc)
+TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb)
 {
     TComList<TComPic*>::iterator  iterPic = rcListPic.begin();
     TComPic*                      pcPic = *(iterPic);
     TComPic*                      pcStPic = pcPic;
+
+    Int pocCycle = 1 << getSPS()->getBitsForPOC();
+    if (!pocHasMsb)
+    {
+        poc = poc % pocCycle;
+    }
+
     while (iterPic != rcListPic.end())
     {
         pcPic = *(iterPic);
-        if (pcPic && (pcPic->getPOC() % (1 << getSPS()->getBitsForPOC())) == (poc % (1 << getSPS()->getBitsForPOC())))
+        if (pcPic && pcPic->getPOC() != this->getPOC() && pcPic->getSlice(0)->isReferenced())
         {
-            if (pcPic->getIsLongTerm())
+            Int picPoc = pcPic->getPOC();
+            if (!pocHasMsb)
             {
-                return pcPic;
-            }
-            else
-            {
-                pcStPic = pcPic;
+                picPoc = picPoc % pocCycle;
             }
 
-            break;
+            if (poc == picPoc)
+            {
+                if (pcPic->getIsLongTerm())
+                {
+                    return pcPic;
+                }
+                else
+                {
+                    pcStPic = pcPic;
+                }
+                break;
+            }
         }
 
         iterPic++;
@@ -285,6 +318,26 @@ Void TComSlice::setRefPOCList()
     }
 }
 
+#if L0034_COMBINED_LIST_CLEANUP
+Void TComSlice::setList1IdxToList0Idx()
+{
+    Int idxL0, idxL1;
+
+    for (idxL1 = 0; idxL1 < getNumRefIdx(REF_PIC_LIST_1); idxL1++)
+    {
+        m_list1IdxToList0Idx[idxL1] = -1;
+        for (idxL0 = 0; idxL0 < getNumRefIdx(REF_PIC_LIST_0); idxL0++)
+        {
+            if (m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC())
+            {
+                m_list1IdxToList0Idx[idxL1] = idxL0;
+                break;
+            }
+        }
+    }
+}
+
+#else // if L0034_COMBINED_LIST_CLEANUP
 Void TComSlice::generateCombinedList()
 {
     if (m_aiNumRefIdx[REF_PIC_LIST_C] > 0)
@@ -307,8 +360,7 @@ Void TComSlice::generateCombinedList()
                 Bool bTempRefIdxInL2 = true;
                 for (Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++)
                 {
-                    if (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() ==
-                        m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC())
+                    if (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC())
                     {
                         m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];
                         m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;
@@ -330,8 +382,7 @@ Void TComSlice::generateCombinedList()
                 Bool bTempRefIdxInL2 = true;
                 for (Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++)
                 {
-                    if (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() ==
-                        m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC())
+                    if (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC())
                     {
                         m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];
                         m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;
@@ -351,19 +402,30 @@ Void TComSlice::generateCombinedList()
     }
 }
 
+#endif // if L0034_COMBINED_LIST_CLEANUP
+
+#if FIX1071
+Void TComSlice::setRefPicList(TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr)
+#else
 Void TComSlice::setRefPicList(TComList<TComPic*>& rcListPic)
+#endif
 {
-    if (m_eSliceType == I_SLICE)
+#if FIX1071
+    if (!checkNumPocTotalCurr)
+#endif
     {
-        ::memset(m_apcRefPicList, 0, sizeof(m_apcRefPicList));
-        ::memset(m_aiNumRefIdx,   0, sizeof(m_aiNumRefIdx));
+        if (m_eSliceType == I_SLICE)
+        {
+            ::memset(m_apcRefPicList, 0, sizeof(m_apcRefPicList));
+            ::memset(m_aiNumRefIdx,   0, sizeof(m_aiNumRefIdx));
 
-        return;
+            return;
+        }
+
+        m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
+        m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     }
 
-    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
-    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
-
     TComPic*  pcRefPic = NULL;
     TComPic*  RefPicSetStCurr0[16];
     TComPic*  RefPicSetStCurr1[16];
@@ -399,26 +461,20 @@ Void TComSlice::setRefPicList(TComList<T
         }
     }
 
-    for (i =
-             m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() +
-             m_pcRPS->getNumberOfLongtermPictures() - 1;
-         i > m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() - 1;
-         i--)
+    for (i = m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures() - 1; i > m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() - 1; i--)
     {
         if (m_pcRPS->getUsed(i))
         {
-            pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
+            pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
             pcRefPic->setIsLongTerm(1);
             pcRefPic->getPicYuvRec()->extendPicBorder();
             RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
             NumPocLtCurr++;
         }
-
         if (pcRefPic == NULL)
         {
-            pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
+            pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
         }
-
         pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i));
     }
 
@@ -426,28 +482,51 @@ Void TComSlice::setRefPicList(TComList<T
     TComPic*  rpsCurrList0[MAX_NUM_REF + 1];
     TComPic*  rpsCurrList1[MAX_NUM_REF + 1];
     Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
-
+#if FIX1071
+    if (checkNumPocTotalCurr)
     {
-        Int cIdx = 0;
-        for (i = 0; i < NumPocStCurr0; i++, cIdx++)
+        // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
+        // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
+        // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
+        if (getRapPicFlag())
         {
-            rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
+            assert(numPocTotalCurr == 0);
         }
 
-        for (i = 0; i < NumPocStCurr1; i++, cIdx++)
+        if (m_eSliceType == I_SLICE)
         {
-            rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
+            ::memset(m_apcRefPicList, 0, sizeof(m_apcRefPicList));
+            ::memset(m_aiNumRefIdx,   0, sizeof(m_aiNumRefIdx));
+
+            return;
         }
 
-        for (i = 0; i < NumPocLtCurr; i++, cIdx++)
-        {
-            rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
-        }
+        assert(numPocTotalCurr != 0);
+
+        m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
+        m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
+    }
+#endif // if FIX1071
+
+    Int cIdx = 0;
+    for (i = 0; i < NumPocStCurr0; i++, cIdx++)
+    {
+        rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
+    }
+
+    for (i = 0; i < NumPocStCurr1; i++, cIdx++)
+    {
+        rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
+    }
+
+    for (i = 0; i < NumPocLtCurr; i++, cIdx++)
+    {
+        rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
     }
 
     if (m_eSliceType == B_SLICE)
     {
-        Int cIdx = 0;
+        cIdx = 0;
         for (i = 0; i < NumPocStCurr1; i++, cIdx++)
         {
             rpsCurrList1[cIdx] = RefPicSetStCurr1[i];
@@ -468,13 +547,8 @@ Void TComSlice::setRefPicList(TComList<T
 
     for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0] - 1); rIdx++)
     {
-        m_apcRefPicList[0][rIdx] =
-            m_RefPicListModification.getRefPicListModificationFlagL0() ? rpsCurrList0[m_RefPicListModification.getRefPicSetIdxL0(
-                                                                                          rIdx)
-            ] : rpsCurrList0[rIdx % numPocTotalCurr];
-        m_bIsUsedAsLongTerm[0][rIdx] =
-            m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >=
-                                                                          (NumPocStCurr0 + NumPocStCurr1))
+        m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? rpsCurrList0[m_RefPicListModification.getRefPicSetIdxL0(rIdx)] : rpsCurrList0[rIdx % numPocTotalCurr];
+        m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1))
             : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
     }
 
@@ -487,15 +561,9 @@ Void TComSlice::setRefPicList(TComList<T
     {
         for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1] - 1); rIdx++)
         {
-            m_apcRefPicList[1][rIdx] =
-                m_RefPicListModification.getRefPicListModificationFlagL1() ? rpsCurrList1[m_RefPicListModification.
-                                                                                          getRefPicSetIdxL1(
-                                                                                              rIdx)] : rpsCurrList1[rIdx %
-                                                                                                                    numPocTotalCurr
-                ];
+            m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? rpsCurrList1[m_RefPicListModification.getRefPicSetIdxL1(rIdx)] : rpsCurrList1[rIdx % numPocTotalCurr];
             m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ?
-                (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >=
-                 (NumPocStCurr0 + NumPocStCurr1)) : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
+                (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)) : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
         }
     }
 }
@@ -508,11 +576,7 @@ Int TComSlice::getNumRpsCurrTempList()
     {
         return 0;
     }
-
-    for (UInt i = 0;
-         i < m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() +
-         m_pcRPS->getNumberOfLongtermPictures();
-         i++)
+    for (UInt i = 0; i < m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
     {
         if (m_pcRPS->getUsed(i))
         {
@@ -531,8 +595,7 @@ Void TComSlice::initEqualRef()
         {
             for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++)
             {
-                m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] =
-                        (iRefIdx1 == iRefIdx2 ? true : false);
+                m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2 ? true : false);
             }
         }
     }
@@ -565,11 +628,9 @@ Void TComSlice::checkColRefIdx(UInt curS
     }
 }
 
-Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA)
+Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
 {
-    for (Int i = 0;
-         i < pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures();
-         i++)
+    for (Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures(); i++)
     {
         if (pocCRA < MAX_UINT && getPOC() > pocCRA)
         {
@@ -577,13 +638,18 @@ Void TComSlice::checkCRA(TComReferencePi
         }
     }
 
-    for (Int i = pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures();
-         i < pReferencePictureSet->getNumberOfPictures();
-         i++)
+    for (Int i = pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++)
     {
         if (pocCRA < MAX_UINT && getPOC() > pocCRA)
         {
-            assert(pReferencePictureSet->getPOC(i) >= pocCRA);
+            if (!pReferencePictureSet->getCheckLTMSBPresent(i))
+            {
+                assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA);
+            }
+            else
+            {
+                assert(pReferencePictureSet->getPOC(i) >= pocCRA);
+            }
         }
     }
 
@@ -642,7 +708,6 @@ Void TComSlice::decodingRefreshMarking(I
             rpcPic = *(iterPic);
             rpcPic->setCurrSliceIdx(0);
             if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false);
-
             iterPic++;
         }
 
@@ -661,14 +726,15 @@ Void TComSlice::decodingRefreshMarking(I
             while (iterPic != rcListPic.end())
             {
                 rpcPic = *(iterPic);
-                if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false);
-
+                if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA)
+                {
+                    rpcPic->getSlice(0)->setReferenced(false);
+                }
                 iterPic++;
             }
 
             bRefreshPending = false;
         }
-
         if (getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) // CRA picture found
         {
             bRefreshPending = true;
@@ -695,11 +761,22 @@ Void TComSlice::copySliceInfo(TComSlice 
     m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2;
     m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
 
+#if L0034_COMBINED_LIST_CLEANUP
+    for (i = 0; i < 2; i++)
+#else
     for (i = 0; i < 3; i++)
+#endif
     {
         m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
     }
 
+#if L0034_COMBINED_LIST_CLEANUP
+    for (i = 0; i < MAX_NUM_REF; i++)
+    {
+        m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
+    }
+
+#else
     for (i = 0; i < 2; i++)
     {
         for (j = 0; j < MAX_NUM_REF_LC; j++)
@@ -718,6 +795,7 @@ Void TComSlice::copySliceInfo(TComSlice 
 
     m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
     m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
+#endif // if L0034_COMBINED_LIST_CLEANUP
     m_bCheckLDC             = pSrc->m_bCheckLDC;
     m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
     m_iSliceQpDeltaCb      = pSrc->m_iSliceQpDeltaCb;
@@ -771,7 +849,9 @@ Void TComSlice::copySliceInfo(TComSlice 
         }
     }
 
+#if !L0034_COMBINED_LIST_CLEANUP
     m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
+#endif
     m_uiTLayer                      = pSrc->m_uiTLayer;
     m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
 
@@ -870,24 +950,23 @@ Void TComSlice::applyReferencePictureSet
     TComPic* rpcPic;
     Int i, isReference;
 
-    Int j = 0;
-
     // loop through all pictures in the reference picture buffer
     TComList<TComPic*>::iterator iterPic = rcListPic.begin();
     while (iterPic != rcListPic.end())
     {
-        j++;
         rpcPic = *(iterPic++);
 
+        if (!rpcPic->getSlice(0)->isReferenced())
+        {
+            continue;
+        }
+
         isReference = 0;
         // loop through all pictures in the Reference Picture Set
         // to see if the picture should be kept as reference picture
-        for (i = 0;
-             i < pReferencePictureSet->getNumberOfPositivePictures() + pReferencePictureSet->getNumberOfNegativePictures();
-             i++)
+        for (i = 0; i < pReferencePictureSet->getNumberOfPositivePictures() + pReferencePictureSet->getNumberOfNegativePictures(); i++)
         {
-            if (!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() +
-                pReferencePictureSet->getDeltaPOC(i))
+            if (!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i))
             {
                 isReference = 1;
                 rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i));
@@ -907,11 +986,7 @@ Void TComSlice::applyReferencePictureSet
             }
             else
             {
-                if (rpcPic->getIsLongTerm() &&
-                    (rpcPic->getPicSym()->getSlice(0)->getPOC() %
-                     (1 <<
-                      rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i) %
-                    (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()))
+                if (rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC() % (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i) % (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()))
                 {
                     isReference = 1;
                     rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i));
@@ -924,9 +999,9 @@ Void TComSlice::applyReferencePictureSet
         if (rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0)
         {
             rpcPic->getSlice(0)->setReferenced(false);
+            rpcPic->setUsedByCurr(0);
             rpcPic->setIsLongTerm(0);
         }
-
         //check that pictures of higher temporal layers are not used
         assert(rpcPic->getSlice(0)->isReferenced() == 0 || rpcPic->getUsedByCurr() == 0 || rpcPic->getTLayer() <= this->getTLayer());
         //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture
@@ -934,58 +1009,44 @@ Void TComSlice::applyReferencePictureSet
         {
             assert(rpcPic->getSlice(0)->isReferenced() == 0 || rpcPic->getTLayer() < this->getTLayer());
         }
-
         //check that pictures marked as temporal layer non-reference pictures are not used for reference
         if (rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer() == this->getTLayer())
         {
-            assert(rpcPic->getSlice(0)->isReferenced() == 0 || rpcPic->getUsedByCurr() == 0 || rpcPic->getSlice(
-                       0)->getTemporalLayerNonReferenceFlag() == false);
+            assert(rpcPic->getSlice(0)->isReferenced() == 0 || rpcPic->getUsedByCurr() == 0 || rpcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() == false);
         }
     }
 }
 
 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet.
 */
-Int TComSlice::checkThatAllRefPicsAreAvailable(TComList<TComPic*>&      rcListPic,
-                                               TComReferencePictureSet *pReferencePictureSet,
-                                               Bool                     printErrors,
-                                               Int                      pocRandomAccess)
+Int TComSlice::checkThatAllRefPicsAreAvailable(TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess)
 {
     TComPic* rpcPic;
-    Int i, isAvailable, j;
+    Int i, isAvailable;
     Int atLeastOneLost = 0;
     Int atLeastOneRemoved = 0;
     Int iPocLost = 0;
 
     // loop through all long-term pictures in the Reference Picture Set
     // to see if the picture should be kept as reference picture
-    for (i = pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures();
-         i < pReferencePictureSet->getNumberOfPictures();
-         i++)
+    for (i = pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++)
     {
-        j = 0;
         isAvailable = 0;
         // loop through all pictures in the reference picture buffer
         TComList<TComPic*>::iterator iterPic = rcListPic.begin();
         while (iterPic != rcListPic.end())
         {
-            j++;
             rpcPic = *(iterPic++);
             if (pReferencePictureSet->getCheckLTMSBPresent(i) == true)
             {
-                if (rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) &&
-                    rpcPic->getSlice(0)->isReferenced())
+                if (rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced())
                 {
                     isAvailable = 1;
                 }
             }
             else
             {
-                if (rpcPic->getIsLongTerm() &&
-                    (rpcPic->getPicSym()->getSlice(0)->getPOC() %
-                     (1 <<
-                      rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i) %
-                    (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
+                if (rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC() % (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i) % (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
                 {
                     isAvailable = 1;
                 }
@@ -998,15 +1059,18 @@ Int TComSlice::checkThatAllRefPicsAreAva
             iterPic = rcListPic.begin();
             while (iterPic != rcListPic.end())
             {
-                j++;
                 rpcPic = *(iterPic++);
 
-                if ((rpcPic->getPicSym()->getSlice(0)->getPOC() %
-                     (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) ==
-                    (this->getPOC() +
-                     pReferencePictureSet->getDeltaPOC(i)) %
-                    (1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) &&
-                    rpcPic->getSlice(0)->isReferenced())
+                Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
+                Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC();
+                Int refPoc = pReferencePictureSet->getPOC(i);
+                if (!pReferencePictureSet->getCheckLTMSBPresent(i))
+                {
+                    curPoc = curPoc % pocCycle;
+                    refPoc = refPoc % pocCycle;
+                }
+
+                if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
                 {
                     isAvailable = 1;
                     rpcPic->setIsLongTerm(1);
@@ -1014,7 +1078,6 @@ Int TComSlice::checkThatAllRefPicsAreAva
                 }
             }
         }
-
         // report that a picture is lost if it is in the Reference Picture Set
         // but not available as reference picture
         if (isAvailable == 0)
@@ -1025,21 +1088,16 @@ Int TComSlice::checkThatAllRefPicsAreAva
                 {
                     if (printErrors)
                     {
-                        printf(
-                            "\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.",
-                            this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
+                        printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
                     }
-
                     atLeastOneRemoved = 1;
                 }
                 else
                 {
                     if (printErrors)
                     {
-                        printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!",
-                               this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
+                        printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
                     }
-
                     atLeastOneLost = 1;
                     iPocLost = this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
                 }
@@ -1049,21 +1107,16 @@ Int TComSlice::checkThatAllRefPicsAreAva
 
     // loop through all short-term pictures in the Reference Picture Set
     // to see if the picture should be kept as reference picture
-    for (i = 0;
-         i < pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures();
-         i++)
+    for (i = 0; i < pReferencePictureSet->getNumberOfNegativePictures() + pReferencePictureSet->getNumberOfPositivePictures(); i++)
     {
-        j = 0;
         isAvailable = 0;
         // loop through all pictures in the reference picture buffer
         TComList<TComPic*>::iterator iterPic = rcListPic.begin();
         while (iterPic != rcListPic.end())
         {
-            j++;
             rpcPic = *(iterPic++);
 
-            if (!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() +
-                pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
+            if (!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
             {
                 isAvailable = 1;
             }
@@ -1078,18 +1131,17 @@ Int TComSlice::checkThatAllRefPicsAreAva
                 if (!pReferencePictureSet->getUsed(i))
                 {
                     if (printErrors)
-                        printf(
-                            "\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.",
-                            this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
-
+                    {
+                        printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
+                    }
                     atLeastOneRemoved = 1;
                 }
                 else
                 {
                     if (printErrors)
-                        printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!",
-                               this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
-
+                    {
+                        printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
+                    }
                     atLeastOneLost = 1;
                     iPocLost = this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
                 }
@@ -1101,7 +1153,6 @@ Int TComSlice::checkThatAllRefPicsAreAva
     {
         return iPocLost + 1;
     }
-
     if (atLeastOneRemoved)
     {
         return -2;
@@ -1114,8 +1165,7 @@ Int TComSlice::checkThatAllRefPicsAreAva
 
 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set
 */
-Void TComSlice::createExplicitReferencePictureSetFromReference(TComList<TComPic*>&      rcListPic,
-                                                               TComReferencePictureSet *pReferencePictureSet)
+Void TComSlice::createExplicitReferencePictureSetFromReference(TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet)
 {
     TComPic* rpcPic;
     Int i, j;
@@ -1135,8 +1185,7 @@ Void TComSlice::createExplicitReferenceP
             j++;
             rpcPic = *(iterPic++);
 
-            if (rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) &&
-                rpcPic->getSlice(0)->isReferenced())
+            if (rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
             {
                 // This picture exists as a reference picture
                 // and should be added to the explicit Reference Picture Set
@@ -1150,7 +1199,6 @@ Void TComSlice::createExplicitReferenceP
                 {
                     nrOfPositivePictures++;
                 }
-
                 k++;
             }
         }
@@ -1200,9 +1248,7 @@ Void TComSlice::createExplicitReferenceP
         pcRPS->setInterRPSPrediction(true);
         pcRPS->setNumRefIdc(iNewIdc);
         pcRPS->setDeltaRPS(deltaRPS);
-        pcRPS->setDeltaRIdxMinus1(
-            pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() -
-            this->getRPSidx());
+        pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());
     }
 
     this->setRPS(pcRPS);
@@ -1310,18 +1356,20 @@ TComVPS::TComVPS()
     for (Int i = 0; i < MAX_TLAYER; i++)
     {
         m_numReorderPics[i] = 0;
+#if L0323_DPB
+        m_uiMaxDecPicBuffering[i] = 1;
+#else
         m_uiMaxDecPicBuffering[i] = 0;
+#endif
         m_uiMaxLatencyIncrease[i] = 0;
     }
 }
 
 TComVPS::~TComVPS()
 {
-    if (m_hrdParameters    != NULL) delete m_hrdParameters;
-
-    if (m_hrdOpSetIdx      != NULL) delete m_hrdOpSetIdx;
-
-    if (m_cprmsPresentFlag != NULL) delete m_cprmsPresentFlag;
+    if (m_hrdParameters    != NULL) delete[] m_hrdParameters;
+    if (m_hrdOpSetIdx      != NULL) delete[] m_hrdOpSetIdx;
+    if (m_cprmsPresentFlag != NULL) delete[] m_cprmsPresentFlag;
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -1350,7 +1398,9 @@ TComSPS::TComSPS()
     , m_usePCM(false)
     , m_pcmLog2MaxSize(5)
     , m_uiPCMLog2MinSize(7)
+#if !L0034_COMBINED_LIST_CLEANUP
     , m_bUseLComb(false)
+#endif
     , m_bitDepthY(8)
     , m_bitDepthC(8)
     , m_qpBDOffsetY(0)
@@ -1372,7 +1422,11 @@ TComSPS::TComSPS()
     for (Int i = 0; i < MAX_TLAYER; i++)
     {
         m_uiMaxLatencyIncrease[i] = 0;
+#if L0323_DPB
+        m_uiMaxDecPicBuffering[i] = 1;
+#else
         m_uiMaxDecPicBuffering[i] = 0;
+#endif
         m_numReorderPics[i]       = 0;
     }
 
@@ -1587,18 +1641,14 @@ TComPPS::~TComPPS()
 {
     if (m_iNumColumnsMinus1 > 0 && m_uniformSpacingFlag == 0)
     {
-        if (m_puiColumnWidth) delete[] m_puiColumnWidth;
-
+        if (m_puiColumnWidth) delete [] m_puiColumnWidth;
         m_puiColumnWidth = NULL;
     }
-
     if (m_iNumRowsMinus1 > 0 && m_uniformSpacingFlag == 0)
     {
-        if (m_puiRowHeight) delete[] m_puiRowHeight;
-
+        if (m_puiRowHeight) delete [] m_puiRowHeight;
         m_puiRowHeight = NULL;
     }
-
     delete m_scalingList;
 }
 
@@ -1717,7 +1767,7 @@ Void TComReferencePictureSet::sortDeltaP
 
     // flip the negative values to largest first
     Int numNegPics = getNumberOfNegativePictures();
-    for (Int j = 0, k = numNegPics - 1; j < (numNegPics >> 1); j++, k--)
+    for (Int j = 0, k = numNegPics - 1; j < numNegPics >> 1; j++, k--)
     {
         Int deltaPOC = getDeltaPOC(j);
         Bool used = getUsed(j);
@@ -1748,7 +1798,6 @@ Void TComReferencePictureSet::printDelta
             printf("%d ", getRefIdc(j));
         }
     }
-
     printf("}\n");
 }
 
@@ -1769,9 +1818,8 @@ Void TComRPSList::destroy()
 {
     if (m_referencePictureSets)
     {
-        delete[] m_referencePictureSets;
+        delete [] m_referencePictureSets;
     }
-
     m_numberOfReferencePictureSets = 0;
     m_referencePictureSets = NULL;
 }
@@ -1837,11 +1885,7 @@ Bool TComSlice::checkDefaultScalingList(
     {
         for (UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++)
         {
-            if (!memcmp(getScalingList()->getScalingListAddress(sizeId,
-                                                                listId),
-                        getScalingList()->getScalingListDefaultAddress(sizeId,
-                                                                       listId), sizeof(Int) *
-                        min(MAX_MATRIX_COEF_NUM, (Int)g_scalingListSize[sizeId]))                                                                                                                             // check value of matrix
+            if (!memcmp(getScalingList()->getScalingListAddress(sizeId, listId), getScalingList()->getScalingListDefaultAddress(sizeId, listId), sizeof(Int) * min(MAX_MATRIX_COEF_NUM, (Int)g_scalingListSize[sizeId])) // check value of matrix
                 && ((sizeId < SCALING_LIST_16x16) || (getScalingList()->getScalingListDC(sizeId, listId) == 16))) // check DC value
             {
                 defaultCounter++;
@@ -1859,11 +1903,7 @@ Bool TComSlice::checkDefaultScalingList(
  */
 Void TComScalingList::processRefMatrix(UInt sizeId, UInt listId, UInt refListId)
 {
-    ::memcpy(getScalingListAddress(sizeId,
-                                   listId),
-             ((listId == refListId) ? getScalingListDefaultAddress(sizeId, refListId) : getScalingListAddress(sizeId,
-                                                                                                              refListId)),
-             sizeof(Int) * min(MAX_MATRIX_COEF_NUM, (Int)g_scalingListSize[sizeId]));
+    ::memcpy(getScalingListAddress(sizeId, listId), ((listId == refListId) ? getScalingListDefaultAddress(sizeId, refListId) : getScalingListAddress(sizeId, refListId)), sizeof(Int) * min(MAX_MATRIX_COEF_NUM, (Int)g_scalingListSize[sizeId]));
 }
 
 /** parse syntax infomation
@@ -1912,7 +1952,6 @@ Bool TComScalingList::xParseScalingList(
                     printf("Error: can't read Matrix :: set Default Matrix\n");
                     return true;
                 }
-
                 src[i] = data;
             }
 
@@ -1938,7 +1977,6 @@ Bool TComScalingList::xParseScalingList(
                     printf("Error: can't read Matrix :: set Default Matrix\n");
                     return true;
                 }
-
                 //overwrite DC value when size of matrix is larger than 16x16
                 setScalingListDC(sizeIdc, listIdc, data);
             }
@@ -1972,7 +2010,7 @@ Void TComScalingList::destroy()
     {
         for (UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++)
         {
-            if (m_scalingListCoef[sizeId][listId]) delete[] m_scalingListCoef[sizeId][listId];
+            if (m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId];
         }
     }
 }
@@ -2015,9 +2053,7 @@ Int* TComScalingList::getScalingListDefa
  */
 Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId)
 {
-    ::memcpy(getScalingListAddress(sizeId,
-                                   listId),
-             getScalingListDefaultAddress(sizeId, listId), sizeof(Int) * min(MAX_MATRIX_COEF_NUM, (Int)g_scalingListSize[sizeId]));
+    ::memcpy(getScalingListAddress(sizeId, listId), getScalingListDefaultAddress(sizeId, listId), sizeof(Int) * min(MAX_MATRIX_COEF_NUM, (Int)g_scalingListSize[sizeId]));
     setScalingListDC(sizeId, listId, SCALING_LIST_DC);
 }
 
@@ -2074,7 +2110,6 @@ Bool ParameterSetManager::activateSPSWit
     {
         printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message.");
     }
-
     return false;
 }
 
@@ -2092,7 +2127,6 @@ Bool ParameterSetManager::activatePPS(In
             printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
             return false;
         }
-
         TComSPS *sps = m_spsMap.getPS(spsId);
         if (sps)
         {
@@ -2102,7 +2136,6 @@ Bool ParameterSetManager::activatePPS(In
                 printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
                 return false;
             }
-
             if (m_vpsMap.getPS(vpsId))
             {
                 m_activePPSId = ppsId;
@@ -2124,7 +2157,6 @@ Bool ParameterSetManager::activatePPS(In
     {
         printf("Warning: tried to activate non-existing PPS.");
     }
-
     return false;
 }
 
--- a/source/Lib/TLibCommon/TComSlice.h	Tue Apr 23 11:06:42 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.h	Tue Apr 23 11:07:40 2013 +0530
@@ -84,17 +84,17 @@ public:
 
     TComReferencePictureSet();
     virtual ~TComReferencePictureSet();
-    Int   getPocLSBLT(Int i)                       { return m_pocLSBLT[i];}
-
-    Void  setPocLSBLT(Int i, Int x)                { m_pocLSBLT[i] = x;}
-
-    Int   getDeltaPocMSBCycleLT(Int i)             { return m_deltaPOCMSBCycleLT[i];}
-
-    Void  setDeltaPocMSBCycleLT(Int i, Int x)      { m_deltaPOCMSBCycleLT[i] = x;}
-
-    Bool  getDeltaPocMSBPresentFlag(Int i)         { return m_deltaPocMSBPresentFlag[i];}
-
-    Void  setDeltaPocMSBPresentFlag(Int i, Bool x) { m_deltaPocMSBPresentFlag[i] = x;}
+    Int   getPocLSBLT(Int i)                       { return m_pocLSBLT[i]; }
+
+    Void  setPocLSBLT(Int i, Int x)                { m_pocLSBLT[i] = x; }
+
+    Int   getDeltaPocMSBCycleLT(Int i)             { return m_deltaPOCMSBCycleLT[i]; }
+
+    Void  setDeltaPocMSBCycleLT(Int i, Int x)      { m_deltaPOCMSBCycleLT[i] = x; }
+
+    Bool  getDeltaPocMSBPresentFlag(Int i)         { return m_deltaPocMSBPresentFlag[i]; }
+
+    Void  setDeltaPocMSBPresentFlag(Int i, Bool x) { m_deltaPocMSBPresentFlag[i] = x; }
 
     Void setUsed(Int bufferNum, Bool used);
     Void setDeltaPOC(Int bufferNum, Int deltaPOC);
@@ -108,33 +108,33 @@ public:
     Int  getPOC(Int bufferNum);
     Int  getNumberOfPictures();
 
-    Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number;}
-
-    Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures;}
-
-    Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number;}
-
-    Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures;}
-
-    Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number;}
-
-    Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures;}
-
-    Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag;}
-
-    Bool getInterRPSPrediction()                  { return m_interRPSPrediction;}
-
-    Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x;}
-
-    Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1;}
-
-    Void setDeltaRPS(Int x)                       { m_deltaRPS = x;}
-
-    Int  getDeltaRPS()                            { return m_deltaRPS;}
-
-    Void setNumRefIdc(Int x)                      { m_numRefIdc = x;}
-
-    Int  getNumRefIdc()                           { return m_numRefIdc;}
+    Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number; }
+
+    Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures; }
+
+    Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number; }
+
+    Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures; }
+
+    Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number; }
+
+    Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures; }
+
+    Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag; }
+
+    Bool getInterRPSPrediction()                  { return m_interRPSPrediction; }
+
+    Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x; }
+
+    Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1; }
+
+    Void setDeltaRPS(Int x)                       { m_deltaRPS = x; }
+
+    Int  getDeltaRPS()                            { return m_deltaRPS; }
+
+    Void setNumRefIdc(Int x)                      { m_numRefIdc = x; }
+
+    Int  getNumRefIdc()                           { return m_numRefIdc; }
 
     Void setRefIdc(Int bufferNum, Int refIdc);
     Int  getRefIdc(Int bufferNum);
@@ -171,26 +171,26 @@ public:
 
     TComScalingList();
     virtual ~TComScalingList();
-    Void     setScalingListPresentFlag(Bool b)                               { m_scalingListPresentFlag = b;}
-
-    Bool     getScalingListPresentFlag()                                     { return m_scalingListPresentFlag;}
-
-    Bool     getUseTransformSkip()                                     { return m_useTransformSkip;}
-
-    Void     setUseTransformSkip(Bool b)                               { m_useTransformSkip = b;}
-
-    Int*     getScalingListAddress(UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId];}          //!< get matrix coefficient
+    Void     setScalingListPresentFlag(Bool b)                               { m_scalingListPresentFlag = b; }
+
+    Bool     getScalingListPresentFlag()                                     { return m_scalingListPresentFlag; }
+
+    Bool     getUseTransformSkip()                                     { return m_useTransformSkip; }
+
+    Void     setUseTransformSkip(Bool b)                               { m_useTransformSkip = b; }
+
+    Int*     getScalingListAddress(UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; }          //!< get matrix coefficient
 
     Bool     checkPredMode(UInt sizeId, UInt listId);
-    Void     setRefMatrixId(UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;}                        //!< set reference matrix ID
-
-    UInt     getRefMatrixId(UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId];}                     //!< get reference matrix ID
+    Void     setRefMatrixId(UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }                    //!< set reference matrix ID
+
+    UInt     getRefMatrixId(UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }                    //!< get reference matrix ID
 
     Int*     getScalingListDefaultAddress(UInt sizeId, UInt listId);                                                         //!< get default matrix coefficient
     Void     processDefaultMarix(UInt sizeId, UInt listId);
-    Void     setScalingListDC(UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u;}                    //!< set DC value
-
-    Int      getScalingListDC(UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId];}                 //!< get DC value
+    Void     setScalingListDC(UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }                   //!< set DC value
+
+    Int      getScalingListDC(UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }                //!< get DC value
 
     Void     checkDcOfMatrix();
     Void     processRefMatrix(UInt sizeId, UInt listId, UInt refListId);
@@ -228,42 +228,42 @@ public:
 
     ProfileTierLevel();
 
-    Int   getProfileSpace() const   { return m_profileSpace;}
-
-    Void  setProfileSpace(Int x)    { m_profileSpace = x;}
-
-    Bool  getTierFlag()     const   { return m_tierFlag;}
-
-    Void  setTierFlag(Bool x)       { m_tierFlag = x;}
-
-    Int   getProfileIdc()   const   { return m_profileIdc;}
-
-    Void  setProfileIdc(Int x)      { m_profileIdc = x;}
-
-    Bool  getProfileCompatibilityFlag(Int i) const    { return m_profileCompatibilityFlag[i];}
-
-    Void  setProfileCompatibilityFlag(Int i, Bool x)  { m_profileCompatibilityFlag[i] = x;}
-
-    Int   getLevelIdc()   const   { return m_levelIdc;}
-
-    Void  setLevelIdc(Int x)      { m_levelIdc = x;}
+    Int   getProfileSpace() const   { return m_profileSpace; }
+
+    Void  setProfileSpace(Int x)    { m_profileSpace = x; }
+
+    Bool  getTierFlag()     const   { return m_tierFlag; }
+
+    Void  setTierFlag(Bool x)       { m_tierFlag = x; }
+
+    Int   getProfileIdc()   const   { return m_profileIdc; }
+
+    Void  setProfileIdc(Int x)      { m_profileIdc = x; }
+
+    Bool  getProfileCompatibilityFlag(Int i) const    { return m_profileCompatibilityFlag[i]; }
+
+    Void  setProfileCompatibilityFlag(Int i, Bool x)  { m_profileCompatibilityFlag[i] = x; }
+
+    Int   getLevelIdc()   const   { return m_levelIdc; }
+
+    Void  setLevelIdc(Int x)      { m_levelIdc = x; }
 
 #if L0046_CONSTRAINT_FLAGS
-    Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag;}
-
-    Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b;}
-
-    Bool getInterlacedSourceFlag() const { return m_interlacedSourceFlag;}
-
-    Void setInterlacedSourceFlag(Bool b) { m_interlacedSourceFlag = b;}
-
-    Bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag;}
-
-    Void setNonPackedConstraintFlag(Bool b) { m_nonPackedConstraintFlag = b;}
-
-    Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag;}
-
-    Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b;}
+    Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; }
+
+    Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; }
+
+    Bool getInterlacedSourceFlag() const { return m_interlacedSourceFlag; }
+
+    Void setInterlacedSourceFlag(Bool b) { m_interlacedSourceFlag = b; }
+
+    Bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; }
+
+    Void setNonPackedConstraintFlag(Bool b) { m_nonPackedConstraintFlag = b; }
+
+    Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
+
+    Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
 
 #endif // if L0046_CONSTRAINT_FLAGS
 };
@@ -278,17 +278,17 @@ class TComPTL
 public:
 
     TComPTL();
-    Bool getSubLayerProfilePresentFlag(Int i) const { return m_subLayerProfilePresentFlag[i];}
-
-    Void setSubLayerProfilePresentFlag(Int i, Bool x) { m_subLayerProfilePresentFlag[i] = x;}
-
-    Bool getSubLayerLevelPresentFlag(Int i) const { return m_subLayerLevelPresentFlag[i];}
-
-    Void setSubLayerLevelPresentFlag(Int i, Bool x) { m_subLayerLevelPresentFlag[i] = x;}
-
-    ProfileTierLevel* getGeneralPTL()  { return &m_generalPTL;}
-
-    ProfileTierLevel* getSubLayerPTL(Int i)  { return &m_subLayerPTL[i];}
+    Bool getSubLayerProfilePresentFlag(Int i) const { return m_subLayerProfilePresentFlag[i]; }
+
+    Void setSubLayerProfilePresentFlag(Int i, Bool x) { m_subLayerProfilePresentFlag[i] = x; }
+
+    Bool getSubLayerLevelPresentFlag(Int i) const { return m_subLayerLevelPresentFlag[i]; }
+
+    Void setSubLayerLevelPresentFlag(Int i, Bool x) { m_subLayerLevelPresentFlag[i] = x; }
+
+    ProfileTierLevel* getGeneralPTL()  { return &m_generalPTL; }
+
+    ProfileTierLevel* getSubLayerPTL(Int i)  { return &m_subLayerPTL[i]; }
 };
 
 /// VPS class
@@ -306,29 +306,29 @@ class TComBitRatePicRateInfo
 public:
 
     TComBitRatePicRateInfo();
-    Bool        getBitRateInfoPresentFlag(Int i) { return m_bitRateInfoPresentFlag[i];}
-
-    Void        setBitRateInfoPresentFlag(Int i, Bool x) { m_bitRateInfoPresentFlag[i] = x;}
-
-    Bool        getPicRateInfoPresentFlag(Int i) { return m_picRateInfoPresentFlag[i];}
-
-    Void        setPicRateInfoPresentFlag(Int i, Bool x) { m_picRateInfoPresentFlag[i] = x;}
-
-    Int         getAvgBitRate(Int i) { return m_avgBitRate[i];}
-
-    Void        setAvgBitRate(Int i, Int x) { m_avgBitRate[i] = x;}
-
-    Int         getMaxBitRate(Int i) { return m_maxBitRate[i];}
-
-    Void        setMaxBitRate(Int i, Int x) { m_maxBitRate[i] = x;}
-
-    Int         getConstantPicRateIdc(Int i) { return m_constantPicRateIdc[i];}
-
-    Void        setConstantPicRateIdc(Int i, Int x) { m_constantPicRateIdc[i] = x;}
-
-    Int         getAvgPicRate(Int i) { return m_avgPicRate[i];}
-
-    Void        setAvgPicRate(Int i, Int x) { m_avgPicRate[i] = x;}
+    Bool        getBitRateInfoPresentFlag(Int i) { return m_bitRateInfoPresentFlag[i]; }
+
+    Void        setBitRateInfoPresentFlag(Int i, Bool x) { m_bitRateInfoPresentFlag[i] = x; }
+
+    Bool        getPicRateInfoPresentFlag(Int i) { return m_picRateInfoPresentFlag[i]; }
+
+    Void        setPicRateInfoPresentFlag(Int i, Bool x) { m_picRateInfoPresentFlag[i] = x; }
+
+    Int         getAvgBitRate(Int i) { return m_avgBitRate[i]; }
+
+    Void        setAvgBitRate(Int i, Int x) { m_avgBitRate[i] = x; }
+
+    Int         getMaxBitRate(Int i) { return m_maxBitRate[i]; }
+
+    Void        setMaxBitRate(Int i, Int x) { m_maxBitRate[i] = x; }
+
+    Int         getConstantPicRateIdc(Int i) { return m_constantPicRateIdc[i]; }
+
+    Void        setConstantPicRateIdc(Int i, Int x) { m_constantPicRateIdc[i] = x; }
+
+    Int         getAvgPicRate(Int i) { return m_avgPicRate[i]; }
+
+    Void        setAvgPicRate(Int i, Int x) { m_avgPicRate[i] = x; }
 };
 
 #endif // if SIGNAL_BITRATE_PICRATE_IN_VPS
@@ -405,130 +405,123 @@ public:
     virtual ~TComHRD() {}
 
 #if !L0043_TIMING_INFO
-    Void setTimingInfoPresentFlag(Bool flag)  { m_timingInfoPresentFlag = flag;}
-
-    Bool getTimingInfoPresentFlag()            { return m_timingInfoPresentFlag;}
-
-    Void setNumUnitsInTick(UInt value) { m_numUnitsInTick = value;}
-
-    UInt getNumUnitsInTick()            { return m_numUnitsInTick;}
-
-    Void setTimeScale(UInt value) { m_timeScale = value;}
-
-    UInt getTimeScale()            { return m_timeScale;}
+    Void setTimingInfoPresentFlag(Bool flag)  { m_timingInfoPresentFlag = flag; }
+
+    Bool getTimingInfoPresentFlag()            { return m_timingInfoPresentFlag; }
+
+    Void setNumUnitsInTick(UInt value) { m_numUnitsInTick = value; }
+
+    UInt getNumUnitsInTick()            { return m_numUnitsInTick; }
+
+    Void setTimeScale(UInt value) { m_timeScale = value; }
+
+    UInt getTimeScale()            { return m_timeScale; }
 
 #endif // if !L0043_TIMING_INFO
 
-    Void setNalHrdParametersPresentFlag(Bool flag)  { m_nalHrdParametersPresentFlag = flag;}
-
-    Bool getNalHrdParametersPresentFlag()            { return m_nalHrdParametersPresentFlag;}
-
-    Void setVclHrdParametersPresentFlag(Bool flag)  { m_vclHrdParametersPresentFlag = flag;}
-
-    Bool getVclHrdParametersPresentFlag()            { return m_vclHrdParametersPresentFlag;}
-
-    Void setSubPicCpbParamsPresentFlag(Bool flag)  { m_subPicCpbParamsPresentFlag = flag;}
-
-    Bool getSubPicCpbParamsPresentFlag()            { return m_subPicCpbParamsPresentFlag;}
-
-    Void setTickDivisorMinus2(UInt value) { m_tickDivisorMinus2 = value;}
-
-    UInt getTickDivisorMinus2()            { return m_tickDivisorMinus2;}
-
-    Void setDuCpbRemovalDelayLengthMinus1(UInt value) { m_duCpbRemovalDelayLengthMinus1 = value;}
-
-    UInt getDuCpbRemovalDelayLengthMinus1()            { return m_duCpbRemovalDelayLengthMinus1;}
-
-    Void setSubPicCpbParamsInPicTimingSEIFlag(Bool flag)   { m_subPicCpbParamsInPicTimingSEIFlag = flag;}
-
-    Bool getSubPicCpbParamsInPicTimingSEIFlag()             { return m_subPicCpbParamsInPicTimingSEIFlag;}
+    Void setNalHrdParametersPresentFlag(Bool flag)  { m_nalHrdParametersPresentFlag = flag; }
+
+    Bool getNalHrdParametersPresentFlag()            { return m_nalHrdParametersPresentFlag; }
+
+    Void setVclHrdParametersPresentFlag(Bool flag)  { m_vclHrdParametersPresentFlag = flag; }
+
+    Bool getVclHrdParametersPresentFlag()            { return m_vclHrdParametersPresentFlag; }
+
+    Void setSubPicCpbParamsPresentFlag(Bool flag)  { m_subPicCpbParamsPresentFlag = flag; }
+
+    Bool getSubPicCpbParamsPresentFlag()            { return m_subPicCpbParamsPresentFlag; }
+
+    Void setTickDivisorMinus2(UInt value) { m_tickDivisorMinus2 = value; }
+
+    UInt getTickDivisorMinus2()            { return m_tickDivisorMinus2; }
+
+    Void setDuCpbRemovalDelayLengthMinus1(UInt value) { m_duCpbRemovalDelayLengthMinus1 = value; }
+
+    UInt getDuCpbRemovalDelayLengthMinus1()            { return m_duCpbRemovalDelayLengthMinus1; }
+
+    Void setSubPicCpbParamsInPicTimingSEIFlag(Bool flag)   { m_subPicCpbParamsInPicTimingSEIFlag = flag; }
+
+    Bool getSubPicCpbParamsInPicTimingSEIFlag()             { return m_subPicCpbParamsInPicTimingSEIFlag; }
 
 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
-    Void setDpbOutputDelayDuLengthMinus1(UInt value)  { m_dpbOutputDelayDuLengthMinus1 = value;}
-
-    UInt getDpbOutputDelayDuLengthMinus1()             { return m_dpbOutputDelayDuLengthMinus1;}
+    Void setDpbOutputDelayDuLengthMinus1(UInt value)  { m_dpbOutputDelayDuLengthMinus1 = value; }
+
+    UInt getDpbOutputDelayDuLengthMinus1()             { return m_dpbOutputDelayDuLengthMinus1; }
 
 #endif
 
-    Void setBitRateScale(UInt value) { m_bitRateScale = value;}
-
-    UInt getBitRateScale()            { return m_bitRateScale;}
-
-    Void setCpbSizeScale(UInt value) { m_cpbSizeScale = value;}
-
-    UInt getCpbSizeScale()            { return m_cpbSizeScale;}
-
-    Void setDuCpbSizeScale(UInt value) { m_ducpbSizeScale = value;}
-
-    UInt getDuCpbSizeScale()            { return m_ducpbSizeScale;}
-
-    Void setInitialCpbRemovalDelayLengthMinus1(UInt value) { m_initialCpbRemovalDelayLengthMinus1 = value;}
-
-    UInt getInitialCpbRemovalDelayLengthMinus1()            { return m_initialCpbRemovalDelayLengthMinus1;}
-
-    Void setCpbRemovalDelayLengthMinus1(UInt value) { m_cpbRemovalDelayLengthMinus1 = value;}
-
-    UInt getCpbRemovalDelayLengthMinus1()            { return m_cpbRemovalDelayLengthMinus1;}
-
-    Void setDpbOutputDelayLengthMinus1(UInt value) { m_dpbOutputDelayLengthMinus1 = value;}
-
-    UInt getDpbOutputDelayLengthMinus1()            { return m_dpbOutputDelayLengthMinus1;}
-
-    Void setFixedPicRateFlag(Int layer, Bool flag)  { m_HRD[layer].fixedPicRateFlag = flag;}
-
-    Bool getFixedPicRateFlag(Int layer)  { return m_HRD[layer].fixedPicRateFlag;}
-
-    Void setFixedPicRateWithinCvsFlag(Int layer, Bool flag)  { m_HRD[layer].fixedPicRateWithinCvsFlag = flag;}
-
-    Bool getFixedPicRateWithinCvsFlag(Int layer)  { return m_HRD[layer].fixedPicRateWithinCvsFlag;}
-
-    Void setPicDurationInTcMinus1(Int layer, UInt value) { m_HRD[layer].picDurationInTcMinus1 = value;}
-
-    UInt getPicDurationInTcMinus1(Int layer) { return m_HRD[layer].picDurationInTcMinus1;}
-
-    Void setLowDelayHrdFlag(Int layer, Bool flag)  { m_HRD[layer].lowDelayHrdFlag = flag;}
-
-    Bool getLowDelayHrdFlag(Int layer)  { return m_HRD[layer].lowDelayHrdFlag;}
-
-    Void setCpbCntMinus1(Int layer, UInt value) { m_HRD[layer].cpbCntMinus1 = value;}
-
-    UInt getCpbCntMinus1(Int layer)  { return m_HRD[layer].cpbCntMinus1;}
-
-    Void setBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl,
-                               UInt value) { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value;}
-
-    UInt getBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl) { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl];}
-
-    Void setCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
-    {
-        m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl] = value;
-    }
-
-    UInt getCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl)  { return m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl];}
-
-    Void setDuCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl,
-                                 UInt value) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;}
-
-    UInt getDuCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl)  { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];}
+    Void setBitRateScale(UInt value) { m_bitRateScale = value;                       }
+
+    UInt getBitRateScale()            { return m_bitRateScale;                        }
+
+    Void setCpbSizeScale(UInt value) { m_cpbSizeScale = value;                       }
+
+    UInt getCpbSizeScale()            { return m_cpbSizeScale;                        }
+
+    Void setDuCpbSizeScale(UInt value) { m_ducpbSizeScale = value;                     }
+
+    UInt getDuCpbSizeScale()            { return m_ducpbSizeScale;                      }
+
+    Void setInitialCpbRemovalDelayLengthMinus1(UInt value) { m_initialCpbRemovalDelayLengthMinus1 = value; }
+
+    UInt getInitialCpbRemovalDelayLengthMinus1()            { return m_initialCpbRemovalDelayLengthMinus1;  }
+
+    Void setCpbRemovalDelayLengthMinus1(UInt value) { m_cpbRemovalDelayLengthMinus1 = value;        }
+
+    UInt getCpbRemovalDelayLengthMinus1()            { return m_cpbRemovalDelayLengthMinus1;         }
+
+    Void setDpbOutputDelayLengthMinus1(UInt value) { m_dpbOutputDelayLengthMinus1 = value;         }
+
+    UInt getDpbOutputDelayLengthMinus1()            { return m_dpbOutputDelayLengthMinus1;          }
+
+    Void setFixedPicRateFlag(Int layer, Bool flag)  { m_HRD[layer].fixedPicRateFlag = flag;         }
+
+    Bool getFixedPicRateFlag(Int layer)  { return m_HRD[layer].fixedPicRateFlag;         }
+
+    Void setFixedPicRateWithinCvsFlag(Int layer, Bool flag)  { m_HRD[layer].fixedPicRateWithinCvsFlag = flag;         }
+
+    Bool getFixedPicRateWithinCvsFlag(Int layer)  { return m_HRD[layer].fixedPicRateWithinCvsFlag;         }
+
+    Void setPicDurationInTcMinus1(Int layer, UInt value) { m_HRD[layer].picDurationInTcMinus1 = value;   }
+
+    UInt getPicDurationInTcMinus1(Int layer) { return m_HRD[layer].picDurationInTcMinus1;    }
+
+    Void setLowDelayHrdFlag(Int layer, Bool flag)  { m_HRD[layer].lowDelayHrdFlag = flag;          }
+
+    Bool getLowDelayHrdFlag(Int layer)  { return m_HRD[layer].lowDelayHrdFlag;          }
+
+    Void setCpbCntMinus1(Int layer, UInt value) { m_HRD[layer].cpbCntMinus1 = value; }
+
+    UInt getCpbCntMinus1(Int layer)  { return m_HRD[layer].cpbCntMinus1; }
+
+    Void setBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value) { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value; }
+
+    UInt getBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl) { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl];  }
+
+    Void setCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value) { m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl] = value;       }
+
+    UInt getCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl)  { return m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl];        }
+
+    Void setDuCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;       }
+
+    UInt getDuCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl)  { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];        }
 
 #if L0363_DU_BIT_RATE
-    Void setDuBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl,
-                                 UInt value) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;}
-
-    UInt getDuBitRateValueMinus1(Int layer, Int cpbcnt,
-                                 Int nalOrVcl)              { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];}
+    Void setDuBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;       }
+
+    UInt getDuBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl)              { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];        }
 
 #endif
-    Void setCbrFlag(Int layer, Int cpbcnt, Int nalOrVcl, UInt value) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;}
-
-    Bool getCbrFlag(Int layer, Int cpbcnt, Int nalOrVcl) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];}
-
-    Void setNumDU(UInt value) { m_numDU = value;}
-
-    UInt getNumDU()            { return m_numDU;}
+    Void setCbrFlag(Int layer, Int cpbcnt, Int nalOrVcl, UInt value) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;            }
+
+    Bool getCbrFlag(Int layer, Int cpbcnt, Int nalOrVcl) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];             }
+
+    Void setNumDU(UInt value) { m_numDU = value;                            }
+
+    UInt getNumDU()            { return m_numDU;          }
 
 #if L0045_CONDITION_SIGNALLING
-    Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag();}
+    Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
 
 #endif
 };
@@ -551,25 +544,25 @@ public:
         , m_pocProportionalToTimingFlag(false)
         , m_numTicksPocDiffOneMinus1(0) {}
 
-    Void setTimingInfoPresentFlag(Bool flag)  { m_timingInfoPresentFlag = flag;}
-
-    Bool getTimingInfoPresentFlag()            { return m_timingInfoPresentFlag;}
-
-    Void setNumUnitsInTick(UInt value) { m_numUnitsInTick = value;}
-
-    UInt getNumUnitsInTick()            { return m_numUnitsInTick;}
-
-    Void setTimeScale(UInt value) { m_timeScale = value;}
-
-    UInt getTimeScale()            { return m_timeScale;}
-
-    Bool getPocProportionalToTimingFlag()            { return m_pocProportionalToTimingFlag;}
-
-    Void setPocProportionalToTimingFlag(Bool x) { m_pocProportionalToTimingFlag = x;}
-
-    Int  getNumTicksPocDiffOneMinus1()            { return m_numTicksPocDiffOneMinus1;}
-
-    Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;}
+    Void setTimingInfoPresentFlag(Bool flag)  { m_timingInfoPresentFlag = flag;               }
+
+    Bool getTimingInfoPresentFlag()            { return m_timingInfoPresentFlag;               }
+
+    Void setNumUnitsInTick(UInt value) { m_numUnitsInTick = value;                     }
+
+    UInt getNumUnitsInTick()            { return m_numUnitsInTick;                      }
+
+    Void setTimeScale(UInt value) { m_timeScale = value;                          }
+
+    UInt getTimeScale()            { return m_timeScale;                           }
+
+    Bool getPocProportionalToTimingFlag()            { return m_pocProportionalToTimingFlag;         }
+
+    Void setPocProportionalToTimingFlag(Bool x) { m_pocProportionalToTimingFlag = x;            }
+
+    Int  getNumTicksPocDiffOneMinus1()            { return m_numTicksPocDiffOneMinus1;            }
+
+    Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;               }
 };
 
 #endif // if L0043_TIMING_INFO
@@ -615,68 +608,68 @@ public:
         m_cprmsPresentFlag = new Bool[getNumHrdParameters()];
     }
 
-    TComHRD* getHrdParameters(UInt i)             { return &m_hrdParameters[i];}
-
-    UInt    getHrdOpSetIdx(UInt i)             { return m_hrdOpSetIdx[i];}
-
-    Void    setHrdOpSetIdx(UInt val, UInt i)   { m_hrdOpSetIdx[i] = val;}
-
-    Bool    getCprmsPresentFlag(UInt i)             { return m_cprmsPresentFlag[i];}
-
-    Void    setCprmsPresentFlag(Bool val, UInt i)   { m_cprmsPresentFlag[i] = val;}
-
-    Int     getVPSId()                   { return m_VPSId;}
-
-    Void    setVPSId(Int i)              { m_VPSId = i;}
-
-    UInt    getMaxTLayers()                   { return m_uiMaxTLayers;}
-
-    Void    setMaxTLayers(UInt t)             { m_uiMaxTLayers = t;}
-
-    UInt    getMaxLayers()                   { return m_uiMaxLayers;}
-
-    Void    setMaxLayers(UInt l)             { m_uiMaxLayers = l;}
-
-    Bool    getTemporalNestingFlag()         { return m_bTemporalIdNestingFlag;}
-
-    Void    setTemporalNestingFlag(Bool t)   { m_bTemporalIdNestingFlag = t;}
-
-    Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;}
-
-    UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer];}
-
-    Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { m_uiMaxDecPicBuffering[tLayer] = v;}
-
-    UInt    getMaxDecPicBuffering(UInt tLayer)                    { return m_uiMaxDecPicBuffering[tLayer];}
-
-    Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[tLayer] = v;}
-
-    UInt    getMaxLatencyIncrease(UInt tLayer)                    { return m_uiMaxLatencyIncrease[tLayer];}
-
-    UInt    getNumHrdParameters()                                 { return m_numHrdParameters;}
-
-    Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;}
-
-    UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId;}
-
-    Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;}
-
-    UInt    getMaxOpSets()                                        { return m_numOpSets;}
-
-    Void    setMaxOpSets(UInt v)                                  { m_numOpSets = v;}
-
-    Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id];}
-
-    Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;}
-
-    TComPTL* getPTL() { return &m_pcPTL;}
+    TComHRD* getHrdParameters(UInt i)             { return &m_hrdParameters[i]; }
+
+    UInt    getHrdOpSetIdx(UInt i)             { return m_hrdOpSetIdx[i]; }
+
+    Void    setHrdOpSetIdx(UInt val, UInt i)   { m_hrdOpSetIdx[i] = val;  }
+
+    Bool    getCprmsPresentFlag(UInt i)             { return m_cprmsPresentFlag[i]; }
+
+    Void    setCprmsPresentFlag(Bool val, UInt i)   { m_cprmsPresentFlag[i] = val;  }
+
+    Int     getVPSId()                   { return m_VPSId;          }
+
+    Void    setVPSId(Int i)              { m_VPSId = i;             }
+
+    UInt    getMaxTLayers()                   { return m_uiMaxTLayers;   }
+
+    Void    setMaxTLayers(UInt t)             { m_uiMaxTLayers = t; }
+
+    UInt    getMaxLayers()                   { return m_uiMaxLayers;   }
+
+    Void    setMaxLayers(UInt l)             { m_uiMaxLayers = l; }
+
+    Bool    getTemporalNestingFlag()         { return m_bTemporalIdNestingFlag;   }
+
+    Void    setTemporalNestingFlag(Bool t)   { m_bTemporalIdNestingFlag = t; }
+
+    Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
+
+    UInt    getNumReorderPics(UInt tLayer)                        { return m_numReorderPics[tLayer]; }
+
+    Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { m_uiMaxDecPicBuffering[tLayer] = v;    }
+
+    UInt    getMaxDecPicBuffering(UInt tLayer)                    { return m_uiMaxDecPicBuffering[tLayer]; }
+
+    Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[tLayer] = v;    }
+
+    UInt    getMaxLatencyIncrease(UInt tLayer)                    { return m_uiMaxLatencyIncrease[tLayer]; }
+
+    UInt    getNumHrdParameters()                                 { return m_numHrdParameters; }
+
+    Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;    }
+
+    UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId; }
+
+    Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;    }
+
+    UInt    getMaxOpSets()                                        { return m_numOpSets; }
+
+    Void    setMaxOpSets(UInt v)                                  { m_numOpSets = v;    }
+
+    Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
+
+    Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
+
+    TComPTL* getPTL() { return &m_pcPTL; }
 
 #if SIGNAL_BITRATE_PICRATE_IN_VPS
-    TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo;}
+    TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }
 
 #endif
 #if L0043_TIMING_INFO
-    TimingInfo* getTimingInfo() { return &m_timingInfo;}
+    TimingInfo* getTimingInfo() { return &m_timingInfo; }
 
 #endif
 };
@@ -701,29 +694,25 @@ public:
         , m_winBottomOffset(0)
     {}
 
-    Bool          getWindowEnabledFlag() const      { return m_enabledFlag;}
-
-    Void          resetWindow()
-    {
-        m_enabledFlag = false;
-        m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;
-    }
-
-    Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0;}
-
-    Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val;m_enabledFlag = true;}
-
-    Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0;}
-
-    Void          setWindowRightOffset(Int val)     { m_winRightOffset = val;m_enabledFlag = true;}
-
-    Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0;}
-
-    Void          setWindowTopOffset(Int val)       { m_winTopOffset = val;m_enabledFlag = true;}
-
-    Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset : 0;}
-
-    Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val;m_enabledFlag = true;}
+    Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
+
+    Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; }
+
+    Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
+
+    Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val; m_enabledFlag = true; }
+
+    Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0; }
+
+    Void          setWindowRightOffset(Int val)     { m_winRightOffset = val; m_enabledFlag = true; }
+
+    Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0; }
+
+    Void          setWindowTopOffset(Int val)       { m_winTopOffset = val; m_enabledFlag = true; }
+
+    Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset : 0; }
+
+    Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
 
     Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
     {
@@ -818,139 +807,139 @@ public:
 
     virtual ~TComVUI() {}
 
-    Bool getAspectRatioInfoPresentFlag() { return m_aspectRatioInfoPresentFlag;}
-
-    Void setAspectRatioInfoPresentFlag(Bool i) { m_aspectRatioInfoPresentFlag = i;}
-
-    Int getAspectRatioIdc() { return m_aspectRatioIdc;}
-
-    Void setAspectRatioIdc(Int i) { m_aspectRatioIdc = i;}
-
-    Int getSarWidth() { return m_sarWidth;}
-
-    Void setSarWidth(Int i) { m_sarWidth = i;}
-
-    Int getSarHeight() { return m_sarHeight;}
-
-    Void setSarHeight(Int i) { m_sarHeight = i;}
-
-    Bool getOverscanInfoPresentFlag() { return m_overscanInfoPresentFlag;}
-
-    Void setOverscanInfoPresentFlag(Bool i) { m_overscanInfoPresentFlag = i;}
-
-    Bool getOverscanAppropriateFlag() { return m_overscanAppropriateFlag;}
-
-    Void setOverscanAppropriateFlag(Bool i) { m_overscanAppropriateFlag = i;}
-
-    Bool getVideoSignalTypePresentFlag() { return m_videoSignalTypePresentFlag;}
-
-    Void setVideoSignalTypePresentFlag(Bool i) { m_videoSignalTypePresentFlag = i;}
-
-    Int getVideoFormat() { return m_videoFormat;}
-
-    Void setVideoFormat(Int i) { m_videoFormat = i;}
-
-    Bool getVideoFullRangeFlag() { return m_videoFullRangeFlag;}
-
-    Void setVideoFullRangeFlag(Bool i) { m_videoFullRangeFlag = i;}
-
-    Bool getColourDescriptionPresentFlag() { return m_colourDescriptionPresentFlag;}
-
-    Void setColourDescriptionPresentFlag(Bool i) { m_colourDescriptionPresentFlag = i;}
-
-    Int getColourPrimaries() { return m_colourPrimaries;}
-
-    Void setColourPrimaries(Int i) { m_colourPrimaries = i;}
-
-    Int getTransferCharacteristics() { return m_transferCharacteristics;}
-
-    Void setTransferCharacteristics(Int i) { m_transferCharacteristics = i;}
-
-    Int getMatrixCoefficients() { return m_matrixCoefficients;}
-
-    Void setMatrixCoefficients(Int i) { m_matrixCoefficients = i;}
-
-    Bool getChromaLocInfoPresentFlag() { return m_chromaLocInfoPresentFlag;}
-
-    Void setChromaLocInfoPresentFlag(Bool i) { m_chromaLocInfoPresentFlag = i;}
-
-    Int getChromaSampleLocTypeTopField() { return m_chromaSampleLocTypeTopField;}
-
-    Void setChromaSampleLocTypeTopField(Int i) { m_chromaSampleLocTypeTopField = i;}
-
-    Int getChromaSampleLocTypeBottomField() { return m_chromaSampleLocTypeBottomField;}
-
-    Void setChromaSampleLocTypeBottomField(Int i) { m_chromaSampleLocTypeBottomField = i;}
-
-    Bool getNeutralChromaIndicationFlag() { return m_neutralChromaIndicationFlag;}
-
-    Void setNeutralChromaIndicationFlag(Bool i) { m_neutralChromaIndicationFlag = i;}
-
-    Bool getFieldSeqFlag() { return m_fieldSeqFlag;}
-
-    Void setFieldSeqFlag(Bool i) { m_fieldSeqFlag = i;}
-
-    Bool getFrameFieldInfoPresentFlag() { return m_frameFieldInfoPresentFlag;}
-
-    Void setFrameFieldInfoPresentFlag(Bool i) { m_frameFieldInfoPresentFlag = i;}
-
-    Window& getDefaultDisplayWindow()                              { return m_defaultDisplayWindow;}
-
-    Void    setDefaultDisplayWindow(Window& defaultDisplayWindow) { m_defaultDisplayWindow = defaultDisplayWindow;}
-
-    Bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag;}
-
-    Void setHrdParametersPresentFlag(Bool i) { m_hrdParametersPresentFlag = i;}
-
-    Bool getBitstreamRestrictionFlag() { return m_bitstreamRestrictionFlag;}
-
-    Void setBitstreamRestrictionFlag(Bool i) { m_bitstreamRestrictionFlag = i;}
-
-    Bool getTilesFixedStructureFlag() { return m_tilesFixedStructureFlag;}
-
-    Void setTilesFixedStructureFlag(Bool i) { m_tilesFixedStructureFlag = i;}
-
-    Bool getMotionVectorsOverPicBoundariesFlag() { return m_motionVectorsOverPicBoundariesFlag;}
-
-    Void setMotionVectorsOverPicBoundariesFlag(Bool i) { m_motionVectorsOverPicBoundariesFlag = i;}
-
-    Bool getRestrictedRefPicListsFlag() { return m_restrictedRefPicListsFlag;}
-
-    Void setRestrictedRefPicListsFlag(Bool b) { m_restrictedRefPicListsFlag = b;}
-
-    Int getMinSpatialSegmentationIdc() { return m_minSpatialSegmentationIdc;}
-
-    Void setMinSpatialSegmentationIdc(Int i) { m_minSpatialSegmentationIdc = i;}
-
-    Int getMaxBytesPerPicDenom() { return m_maxBytesPerPicDenom;}
-
-    Void setMaxBytesPerPicDenom(Int i) { m_maxBytesPerPicDenom = i;}
-
-    Int getMaxBitsPerMinCuDenom() { return m_maxBitsPerMinCuDenom;}
-
-    Void setMaxBitsPerMinCuDenom(Int i) { m_maxBitsPerMinCuDenom = i;}
-
-    Int getLog2MaxMvLengthHorizontal() { return m_log2MaxMvLengthHorizontal;}
-
-    Void setLog2MaxMvLengthHorizontal(Int i) { m_log2MaxMvLengthHorizontal = i;}
-
-    Int getLog2MaxMvLengthVertical() { return m_log2MaxMvLengthVertical;}
-
-    Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i;}
-
-    TComHRD* getHrdParameters()             { return &m_hrdParameters;}
+    Bool getAspectRatioInfoPresentFlag() { return m_aspectRatioInfoPresentFlag; }
+
+    Void setAspectRatioInfoPresentFlag(Bool i) { m_aspectRatioInfoPresentFlag = i; }
+
+    Int getAspectRatioIdc() { return m_aspectRatioIdc; }
+
+    Void setAspectRatioIdc(Int i) { m_aspectRatioIdc = i; }
+
+    Int getSarWidth() { return m_sarWidth; }
+
+    Void setSarWidth(Int i) { m_sarWidth = i; }
+
+    Int getSarHeight() { return m_sarHeight; }
+
+    Void setSarHeight(Int i) { m_sarHeight = i; }
+
+    Bool getOverscanInfoPresentFlag() { return m_overscanInfoPresentFlag; }
+
+    Void setOverscanInfoPresentFlag(Bool i) { m_overscanInfoPresentFlag = i; }
+
+    Bool getOverscanAppropriateFlag() { return m_overscanAppropriateFlag; }
+
+    Void setOverscanAppropriateFlag(Bool i) { m_overscanAppropriateFlag = i; }
+
+    Bool getVideoSignalTypePresentFlag() { return m_videoSignalTypePresentFlag; }
+
+    Void setVideoSignalTypePresentFlag(Bool i) { m_videoSignalTypePresentFlag = i; }
+
+    Int getVideoFormat() { return m_videoFormat; }
+
+    Void setVideoFormat(Int i) { m_videoFormat = i; }
+
+    Bool getVideoFullRangeFlag() { return m_videoFullRangeFlag; }
+
+    Void setVideoFullRangeFlag(Bool i) { m_videoFullRangeFlag = i; }
+
+    Bool getColourDescriptionPresentFlag() { return m_colourDescriptionPresentFlag; }
+
+    Void setColourDescriptionPresentFlag(Bool i) { m_colourDescriptionPresentFlag = i; }
+
+    Int getColourPrimaries() { return m_colourPrimaries; }
+
+    Void setColourPrimaries(Int i) { m_colourPrimaries = i; }
+
+    Int getTransferCharacteristics() { return m_transferCharacteristics; }
+
+    Void setTransferCharacteristics(Int i) { m_transferCharacteristics = i; }
+
+    Int getMatrixCoefficients() { return m_matrixCoefficients; }
+
+    Void setMatrixCoefficients(Int i) { m_matrixCoefficients = i; }
+
+    Bool getChromaLocInfoPresentFlag() { return m_chromaLocInfoPresentFlag; }
+
+    Void setChromaLocInfoPresentFlag(Bool i) { m_chromaLocInfoPresentFlag = i; }
+
+    Int getChromaSampleLocTypeTopField() { return m_chromaSampleLocTypeTopField; }
+
+    Void setChromaSampleLocTypeTopField(Int i) { m_chromaSampleLocTypeTopField = i; }
+
+    Int getChromaSampleLocTypeBottomField() { return m_chromaSampleLocTypeBottomField; }
+
+    Void setChromaSampleLocTypeBottomField(Int i) { m_chromaSampleLocTypeBottomField = i; }
+
+    Bool getNeutralChromaIndicationFlag() { return m_neutralChromaIndicationFlag; }
+
+    Void setNeutralChromaIndicationFlag(Bool i) { m_neutralChromaIndicationFlag = i; }
+
+    Bool getFieldSeqFlag() { return m_fieldSeqFlag; }
+
+    Void setFieldSeqFlag(Bool i) { m_fieldSeqFlag = i; }
+
+    Bool getFrameFieldInfoPresentFlag() { return m_frameFieldInfoPresentFlag; }
+
+    Void setFrameFieldInfoPresentFlag(Bool i) { m_frameFieldInfoPresentFlag = i; }
+
+    Window& getDefaultDisplayWindow()                              { return m_defaultDisplayWindow;                }
+
+    Void    setDefaultDisplayWindow(Window& defaultDisplayWindow) { m_defaultDisplayWindow = defaultDisplayWindow; }
+
+    Bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; }
+
+    Void setHrdParametersPresentFlag(Bool i) { m_hrdParametersPresentFlag = i; }
+
+    Bool getBitstreamRestrictionFlag() { return m_bitstreamRestrictionFlag; }
+
+    Void setBitstreamRestrictionFlag(Bool i) { m_bitstreamRestrictionFlag = i; }
+
+    Bool getTilesFixedStructureFlag() { return m_tilesFixedStructureFlag; }
+
+    Void setTilesFixedStructureFlag(Bool i) { m_tilesFixedStructureFlag = i; }
+
+    Bool getMotionVectorsOverPicBoundariesFlag() { return m_motionVectorsOverPicBoundariesFlag; }
+
+    Void setMotionVectorsOverPicBoundariesFlag(Bool i) { m_motionVectorsOverPicBoundariesFlag = i; }
+
+    Bool getRestrictedRefPicListsFlag() { return m_restrictedRefPicListsFlag; }
+
+    Void setRestrictedRefPicListsFlag(Bool b) { m_restrictedRefPicListsFlag = b; }
+
+    Int getMinSpatialSegmentationIdc() { return m_minSpatialSegmentationIdc; }
+
+    Void setMinSpatialSegmentationIdc(Int i) { m_minSpatialSegmentationIdc = i; }
+
+    Int getMaxBytesPerPicDenom() { return m_maxBytesPerPicDenom; }
+
+    Void setMaxBytesPerPicDenom(Int i) { m_maxBytesPerPicDenom = i; }
+
+    Int getMaxBitsPerMinCuDenom() { return m_maxBitsPerMinCuDenom; }
+
+    Void setMaxBitsPerMinCuDenom(Int i) { m_maxBitsPerMinCuDenom = i; }
+
+    Int getLog2MaxMvLengthHorizontal() { return m_log2MaxMvLengthHorizontal; }
+
+    Void setLog2MaxMvLengthHorizontal(Int i) { m_log2MaxMvLengthHorizontal = i; }
+
+    Int getLog2MaxMvLengthVertical() { return m_log2MaxMvLengthVertical; }
+
+    Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i; }
+
+    TComHRD* getHrdParameters()             { return &m_hrdParameters; }
 
 #if L0043_TIMING_INFO
-    TimingInfo* getTimingInfo() { return &m_timingInfo;}
+    TimingInfo* getTimingInfo() { return &m_timingInfo; }
 
 #else
-    Bool getPocProportionalToTimingFlag() { return m_pocProportionalToTimingFlag;}
-
-    Void setPocProportionalToTimingFlag(Bool x) { m_pocProportionalToTimingFlag = x;}
-
-    Int  getNumTicksPocDiffOneMinus1() { return m_numTicksPocDiffOneMinus1;}
-
-    Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;}
+    Bool getPocProportionalToTimingFlag() { return m_pocProportionalToTimingFlag; }
+
+    Void setPocProportionalToTimingFlag(Bool x) { m_pocProportionalToTimingFlag = x; }
+
+    Int  getNumTicksPocDiffOneMinus1() { return m_numTicksPocDiffOneMinus1; }
+
+    Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x; }
 
 #endif // if L0043_TIMING_INFO
 };
@@ -993,7 +982,9 @@ private:
     UInt        m_uiPCMLog2MinSize;
     Bool        m_useAMP;
 
+#if !L0034_COMBINED_LIST_CLEANUP
     Bool        m_bUseLComb;
+#endif
 
     // Parameter
     Int         m_bitDepthY;
@@ -1040,218 +1031,213 @@ public:
     TComSPS();
     virtual ~TComSPS();
 
-    Int  getVPSId()         { return m_VPSId;}
-
-    Void setVPSId(Int i)    { m_VPSId = i;}
-
-    Int  getSPSId()         { return m_SPSId;}
-
-    Void setSPSId(Int i)    { m_SPSId = i;}
-
-    Int  getChromaFormatIdc()         { return m_chromaFormatIdc;}
-
-    Void setChromaFormatIdc(Int i)    { m_chromaFormatIdc = i;}
-
-    static Int getWinUnitX(Int chromaFormatIdc)
-    {
-        assert(chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC);
-        return m_winUnitX[chromaFormatIdc];
-    }
-
-    static Int getWinUnitY(Int chromaFormatIdc)
-    {
-        assert(chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC);
-        return m_winUnitY[chromaFormatIdc];
-    }
+    Int  getVPSId()         { return m_VPSId;          }
+
+    Void setVPSId(Int i)    { m_VPSId = i;             }
+
+    Int  getSPSId()         { return m_SPSId;          }
+
+    Void setSPSId(Int i)    { m_SPSId = i;             }
+
+    Int  getChromaFormatIdc()         { return m_chromaFormatIdc;       }
+
+    Void setChromaFormatIdc(Int i)    { m_chromaFormatIdc = i;          }
+
+    static Int getWinUnitX(Int chromaFormatIdc) { assert(chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
+
+    static Int getWinUnitY(Int chromaFormatIdc) { assert(chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
 
     // structure
-    Void setPicWidthInLumaSamples(UInt u) { m_picWidthInLumaSamples = u;}
-
-    UInt getPicWidthInLumaSamples()         { return m_picWidthInLumaSamples;}
-
-    Void setPicHeightInLumaSamples(UInt u) { m_picHeightInLumaSamples = u;}
-
-    UInt getPicHeightInLumaSamples()         { return m_picHeightInLumaSamples;}
-
-    Window& getConformanceWindow()                           { return m_conformanceWindow;}
-
-    Void    setConformanceWindow(Window& conformanceWindow) { m_conformanceWindow = conformanceWindow;}
-
-    UInt  getNumLongTermRefPicSPS()             { return m_numLongTermRefPicSPS;}
-
-    Void  setNumLongTermRefPicSPS(UInt val)     { m_numLongTermRefPicSPS = val;}
-
-    UInt  getLtRefPicPocLsbSps(UInt index)             { return m_ltRefPicPocLsbSps[index];}
-
-    Void  setLtRefPicPocLsbSps(UInt index, UInt val)     { m_ltRefPicPocLsbSps[index] = val;}
-
-    Bool getUsedByCurrPicLtSPSFlag(Int i)        { return m_usedByCurrPicLtSPSFlag[i];}
-
-    Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
-
-    Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize;}
-
-    Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val;}
-
-    Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize;}
-
-    Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val;}
-
-    Void setMaxCUWidth(UInt u) { m_uiMaxCUWidth = u;}
-
-    UInt getMaxCUWidth()         { return m_uiMaxCUWidth;}
-
-    Void setMaxCUHeight(UInt u) { m_uiMaxCUHeight = u;}
-
-    UInt getMaxCUHeight()         { return m_uiMaxCUHeight;}
-
-    Void setMaxCUDepth(UInt u) { m_uiMaxCUDepth = u;}
-
-    UInt getMaxCUDepth()         { return m_uiMaxCUDepth;}
-
-    Void setUsePCM(Bool b) { m_usePCM = b;}
-
-    Bool getUsePCM()         { return m_usePCM;}
-
-    Void setPCMLog2MaxSize(UInt u) { m_pcmLog2MaxSize = u;}
-
-    UInt getPCMLog2MaxSize()         { return m_pcmLog2MaxSize;}
-
-    Void setPCMLog2MinSize(UInt u) { m_uiPCMLog2MinSize = u;}
-
-    UInt getPCMLog2MinSize()         { return m_uiPCMLog2MinSize;}
-
-    Void setBitsForPOC(UInt u) { m_uiBitsForPOC = u;}
-
-    UInt getBitsForPOC()         { return m_uiBitsForPOC;}
-
-    Bool getUseAMP() { return m_useAMP;}
-
-    Void setUseAMP(Bool b) { m_useAMP = b;}
-
-    Void setQuadtreeTULog2MaxSize(UInt u) { m_uiQuadtreeTULog2MaxSize = u;}
-
-    UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize;}
-
-    Void setQuadtreeTULog2MinSize(UInt u) { m_uiQuadtreeTULog2MinSize = u;}
-
-    UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize;}
-
-    Void setQuadtreeTUMaxDepthInter(UInt u) { m_uiQuadtreeTUMaxDepthInter = u;}
-
-    Void setQuadtreeTUMaxDepthIntra(UInt u) { m_uiQuadtreeTUMaxDepthIntra = u;}
-
-    UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter;}
-
-    UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra;}
-
-    Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;}
-
-    Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer];}
+    Void setPicWidthInLumaSamples(UInt u) { m_picWidthInLumaSamples = u;        }
+
+    UInt getPicWidthInLumaSamples()         { return m_picWidthInLumaSamples;    }
+
+    Void setPicHeightInLumaSamples(UInt u) { m_picHeightInLumaSamples = u;       }
+
+    UInt getPicHeightInLumaSamples()         { return m_picHeightInLumaSamples;   }
+
+    Window& getConformanceWindow()                           { return m_conformanceWindow;             }
+
+    Void    setConformanceWindow(Window& conformanceWindow) { m_conformanceWindow = conformanceWindow; }
+
+    UInt  getNumLongTermRefPicSPS()             { return m_numLongTermRefPicSPS; }
+
+    Void  setNumLongTermRefPicSPS(UInt val)     { m_numLongTermRefPicSPS = val; }
+
+    UInt  getLtRefPicPocLsbSps(UInt index)             { return m_ltRefPicPocLsbSps[index]; }
+
+    Void  setLtRefPicPocLsbSps(UInt index, UInt val)     { m_ltRefPicPocLsbSps[index] = val; }
+
+    Bool getUsedByCurrPicLtSPSFlag(Int i)        { return m_usedByCurrPicLtSPSFlag[i]; }
+
+    Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x; }
+
+    Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
+
+    Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
+
+    Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
+
+    Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
+
+    Void setMaxCUWidth(UInt u) { m_uiMaxCUWidth = u;      }
+
+    UInt getMaxCUWidth()         { return m_uiMaxCUWidth;  }
+
+    Void setMaxCUHeight(UInt u) { m_uiMaxCUHeight = u;     }
+
+    UInt getMaxCUHeight()         { return m_uiMaxCUHeight; }
+
+    Void setMaxCUDepth(UInt u) { m_uiMaxCUDepth = u;      }
+
+    UInt getMaxCUDepth()         { return m_uiMaxCUDepth;  }
+
+    Void setUsePCM(Bool b) { m_usePCM = b;           }
+
+    Bool getUsePCM()         { return m_usePCM;        }
+
+    Void setPCMLog2MaxSize(UInt u) { m_pcmLog2MaxSize = u;      }
+
+    UInt getPCMLog2MaxSize()         { return m_pcmLog2MaxSize;  }
+
+    Void setPCMLog2MinSize(UInt u) { m_uiPCMLog2MinSize = u;      }
+
+    UInt getPCMLog2MinSize()         { return m_uiPCMLog2MinSize;  }
+
+    Void setBitsForPOC(UInt u) { m_uiBitsForPOC = u;      }
+
+    UInt getBitsForPOC()         { return m_uiBitsForPOC;   }
+
+    Bool getUseAMP() { return m_useAMP; }
+
+    Void setUseAMP(Bool b) { m_useAMP = b; }
+
+    Void setQuadtreeTULog2MaxSize(UInt u) { m_uiQuadtreeTULog2MaxSize = u;    }
+
+    UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
+
+    Void setQuadtreeTULog2MinSize(UInt u) { m_uiQuadtreeTULog2MinSize = u;    }
+
+    UInt getQuadtreeTULog2MinSize()         { return m_uiQuadtreeTULog2MinSize; }
+
+    Void setQuadtreeTUMaxDepthInter(UInt u) { m_uiQuadtreeTUMaxDepthInter = u;    }
+
+    Void setQuadtreeTUMaxDepthIntra(UInt u) { m_uiQuadtreeTUMaxDepthIntra = u;    }
+
+    UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
+
+    UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
+
+    Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
+
+    Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
 
     Void         createRPSList(Int numRPS);
-    TComRPSList* getRPSList()                      { return &m_RPSList;}
-
-    Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent;}
-
-    Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent = b;}
-
-    Bool      getTMVPFlagsPresent()         { return m_TMVPFlagsPresent;}
-
-    Void      setTMVPFlagsPresent(Bool b)   { m_TMVPFlagsPresent = b;}
+    TComRPSList* getRPSList()                      { return &m_RPSList;          }
+
+    Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
+
+    Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent = b;      }
+
+    Bool      getTMVPFlagsPresent()         { return m_TMVPFlagsPresent; }
+
+    Void      setTMVPFlagsPresent(Bool b)   { m_TMVPFlagsPresent = b;      }
 
     // physical transform
-    Void setMaxTrSize(UInt u) { m_uiMaxTrSize = u;}
-
-    UInt getMaxTrSize()         { return m_uiMaxTrSize;}
+    Void setMaxTrSize(UInt u) { m_uiMaxTrSize = u;       }
+
+    UInt getMaxTrSize()         { return m_uiMaxTrSize;   }
 
     // Tool list
-    Void setUseLComb(Bool b)   { m_bUseLComb = b;}
-
-    Bool getUseLComb()         { return m_bUseLComb;}
-
-    Bool getUseLossless()         { return m_useLossless;}
-
-    Void setUseLossless(Bool b) { m_useLossless  = b;}
+#if !L0034_COMBINED_LIST_CLEANUP
+    Void setUseLComb(Bool b)   { m_bUseLComb = b;         }
+
+    Bool getUseLComb()         { return m_bUseLComb;      }
+
+#endif
+
+    Bool getUseLossless()         { return m_useLossless; }
+
+    Void setUseLossless(Bool b) { m_useLossless  = b; }
 
     // AMP accuracy
-    Int       getAMPAcc(UInt uiDepth) { return m_iAMPAcc[uiDepth];}
-
-    Void      setAMPAcc(UInt uiDepth, Int iAccu) { assert(uiDepth < g_uiMaxCUDepth);m_iAMPAcc[uiDepth] = iAccu;}
+    Int       getAMPAcc(UInt uiDepth) { return m_iAMPAcc[uiDepth]; }
+
+    Void      setAMPAcc(UInt uiDepth, Int iAccu) { assert(uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
 
     // Bit-depth
-    Int      getBitDepthY() { return m_bitDepthY;}
-
-    Void     setBitDepthY(Int u) { m_bitDepthY = u;}
-
-    Int      getBitDepthC() { return m_bitDepthC;}
-
-    Void     setBitDepthC(Int u) { m_bitDepthC = u;}
-
-    Int       getQpBDOffsetY()             { return m_qpBDOffsetY;}
-
-    Void      setQpBDOffsetY(Int value) { m_qpBDOffsetY = value;}
-
-    Int       getQpBDOffsetC()             { return m_qpBDOffsetC;}
-
-    Void      setQpBDOffsetC(Int value) { m_qpBDOffsetC = value;}
-
-    Void setUseSAO(Bool bVal)  { m_bUseSAO = bVal;}
-
-    Bool getUseSAO()           { return m_bUseSAO;}
-
-    UInt      getMaxTLayers()                           { return m_uiMaxTLayers;}
-
-    Void      setMaxTLayers(UInt uiMaxTLayers)        { assert(uiMaxTLayers <= MAX_TLAYER);m_uiMaxTLayers = uiMaxTLayers;}
-
-    Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag;}
-
-    Void      setTemporalIdNestingFlag(Bool bValue)   { m_bTemporalIdNestingFlag = bValue;}
-
-    UInt      getPCMBitDepthLuma()         { return m_uiPCMBitDepthLuma;}
-
-    Void      setPCMBitDepthLuma(UInt u) { m_uiPCMBitDepthLuma = u;}
-
-    UInt      getPCMBitDepthChroma()         { return m_uiPCMBitDepthChroma;}
-
-    Void      setPCMBitDepthChroma(UInt u) { m_uiPCMBitDepthChroma = u;}
-
-    Void      setPCMFilterDisableFlag(Bool bValue)    { m_bPCMFilterDisableFlag = bValue;}
-
-    Bool      getPCMFilterDisableFlag()                    { return m_bPCMFilterDisableFlag;}
-
-    Bool getScalingListFlag()         { return m_scalingListEnabledFlag;}
-
-    Void setScalingListFlag(Bool b) { m_scalingListEnabledFlag  = b;}
-
-    Bool getScalingListPresentFlag()         { return m_scalingListPresentFlag;}
-
-    Void setScalingListPresentFlag(Bool b) { m_scalingListPresentFlag  = b;}
+    Int      getBitDepthY() { return m_bitDepthY; }
+
+    Void     setBitDepthY(Int u) { m_bitDepthY = u; }
+
+    Int      getBitDepthC() { return m_bitDepthC; }
+
+    Void     setBitDepthC(Int u) { m_bitDepthC = u; }
+
+    Int       getQpBDOffsetY()             { return m_qpBDOffsetY;   }
+
+    Void      setQpBDOffsetY(Int value) { m_qpBDOffsetY = value;  }
+
+    Int       getQpBDOffsetC()             { return m_qpBDOffsetC;   }
+
+    Void      setQpBDOffsetC(Int value) { m_qpBDOffsetC = value;  }
+
+    Void setUseSAO(Bool bVal)  { m_bUseSAO = bVal; }
+
+    Bool getUseSAO()           { return m_bUseSAO; }
+
+    UInt      getMaxTLayers()                           { return m_uiMaxTLayers; }
+
+    Void      setMaxTLayers(UInt uiMaxTLayers)        { assert(uiMaxTLayers <= MAX_TLAYER); m_uiMaxTLayers = uiMaxTLayers; }
+
+    Bool      getTemporalIdNestingFlag()                { return m_bTemporalIdNestingFlag; }
+
+    Void      setTemporalIdNestingFlag(Bool bValue)   { m_bTemporalIdNestingFlag = bValue; }
+
+    UInt      getPCMBitDepthLuma()         { return m_uiPCMBitDepthLuma;     }
+
+    Void      setPCMBitDepthLuma(UInt u) { m_uiPCMBitDepthLuma = u;        }
+
+    UInt      getPCMBitDepthChroma()         { return m_uiPCMBitDepthChroma;   }
+
+    Void      setPCMBitDepthChroma(UInt u) { m_uiPCMBitDepthChroma = u;      }
+
+    Void      setPCMFilterDisableFlag(Bool bValue)    { m_bPCMFilterDisableFlag = bValue; }
+
+    Bool      getPCMFilterDisableFlag()                    { return m_bPCMFilterDisableFlag;   }
+
+    Bool getScalingListFlag()         { return m_scalingListEnabledFlag;     }
+
+    Void setScalingListFlag(Bool b) { m_scalingListEnabledFlag  = b;       }
+
+    Bool getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
+
+    Void setScalingListPresentFlag(Bool b) { m_scalingListPresentFlag  = b;       }
 
     Void setScalingList(TComScalingList *scalingList);
-    TComScalingList* getScalingList()       { return m_scalingList;}               //!< get ScalingList class pointer in SPS
-
-    UInt getMaxDecPicBuffering(UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer];}
-
-    Void setMaxDecPicBuffering(UInt ui, UInt tlayer) { m_uiMaxDecPicBuffering[tlayer] = ui;}
-
-    UInt getMaxLatencyIncrease(UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];}
-
-    Void setMaxLatencyIncrease(UInt ui, UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;}
-
-    Void setUseStrongIntraSmoothing(Bool bVal)  { m_useStrongIntraSmoothing = bVal;}
-
-    Bool getUseStrongIntraSmoothing()           { return m_useStrongIntraSmoothing;}
-
-    Bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag;}
-
-    Void setVuiParametersPresentFlag(Bool b) { m_vuiParametersPresentFlag = b;}
-
-    TComVUI* getVuiParameters() { return &m_vuiParameters;}
+    TComScalingList* getScalingList()       { return m_scalingList; }              //!< get ScalingList class pointer in SPS
+
+    UInt getMaxDecPicBuffering(UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
+
+    Void setMaxDecPicBuffering(UInt ui, UInt tlayer) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
+
+    UInt getMaxLatencyIncrease(UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
+
+    Void setMaxLatencyIncrease(UInt ui, UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
+
+    Void setUseStrongIntraSmoothing(Bool bVal)  { m_useStrongIntraSmoothing = bVal; }
+
+    Bool getUseStrongIntraSmoothing()           { return m_useStrongIntraSmoothing; }
+
+    Bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; }
+
+    Void setVuiParametersPresentFlag(Bool b) { m_vuiParametersPresentFlag = b; }
+
+    TComVUI* getVuiParameters() { return &m_vuiParameters; }
 
     Void setHrdParameters(UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess);
 
-    TComPTL* getPTL()     { return &m_pcPTL;}
+    TComPTL* getPTL()     { return &m_pcPTL; }
 };
 
 /// Reference Picture Lists class
@@ -1272,21 +1258,21 @@ public:
     Void  create();
     Void  destroy();
 
-    Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0;}
-
-    Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag;}
-
-    Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1;}
-
-    Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag;}
-
-    Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx;}
-
-    UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx];}
-
-    Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx;}
-
-    UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx];}
+    Bool       getRefPicListModificationFlagL0() { return m_bRefPicListModificationFlagL0; }
+
+    Void       setRefPicListModificationFlagL0(Bool flag) { m_bRefPicListModificationFlagL0 = flag; }
+
+    Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
+
+    Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
+
+    Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
+
+    UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
+
+    Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
+
+    UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
 };
 
 /// PPS class
@@ -1354,101 +1340,101 @@ public:
     TComPPS();
     virtual ~TComPPS();
 
-    Int       getPPSId()      { return m_PPSId;}
-
-    Void      setPPSId(Int i) { m_PPSId = i;}
-
-    Int       getSPSId()      { return m_SPSId;}
-
-    Void      setSPSId(Int i) { m_SPSId = i;}
-
-    Int       getPicInitQPMinus26()         { return m_picInitQPMinus26;}
-
-    Void      setPicInitQPMinus26(Int i)  { m_picInitQPMinus26 = i;}
-
-    Bool      getUseDQP()                   { return m_useDQP;}
-
-    Void      setUseDQP(Bool b)           { m_useDQP   = b;}
-
-    Bool      getConstrainedIntraPred()         { return m_bConstrainedIntraPred;}
-
-    Void      setConstrainedIntraPred(Bool b) { m_bConstrainedIntraPred = b;}
-
-    Bool      getSliceChromaQpFlag()         { return m_bSliceChromaQpFlag;}
-
-    Void      setSliceChromaQpFlag(Bool b) { m_bSliceChromaQpFlag = b;}
-
-    Void      setSPS(TComSPS* pcSPS) { m_pcSPS = pcSPS;}
-
-    TComSPS*  getSPS()         { return m_pcSPS;}
-
-    Void      setMaxCuDQPDepth(UInt u) { m_uiMaxCuDQPDepth = u;}
-
-    UInt      getMaxCuDQPDepth()         { return m_uiMaxCuDQPDepth;}
-
-    Void      setMinCuDQPSize(UInt u) { m_uiMinCuDQPSize = u;}
-
-    UInt      getMinCuDQPSize()         { return m_uiMinCuDQPSize;}
-
-    Void      setChromaCbQpOffset(Int i) { m_chromaCbQpOffset = i;}
-
-    Int       getChromaCbQpOffset()        { return m_chromaCbQpOffset;}
-
-    Void      setChromaCrQpOffset(Int i) { m_chromaCrQpOffset = i;}
-
-    Int       getChromaCrQpOffset()        { return m_chromaCrQpOffset;}
-
-    Void      setNumRefIdxL0DefaultActive(UInt ui)    { m_numRefIdxL0DefaultActive = ui;}
-
-    UInt      getNumRefIdxL0DefaultActive()           { return m_numRefIdxL0DefaultActive;}
-
-    Void      setNumRefIdxL1DefaultActive(UInt ui)    { m_numRefIdxL1DefaultActive = ui;}
-
-    UInt      getNumRefIdxL1DefaultActive()           { return m_numRefIdxL1DefaultActive;}
-
-    Bool getUseWP()          { return m_bUseWeightPred;}
-
-    Bool getWPBiPred()          { return m_useWeightedBiPred;}
-
-    Void setUseWP(Bool b)  { m_bUseWeightPred = b;}
-
-    Void setWPBiPred(Bool b)  { m_useWeightedBiPred = b;}
-
-    Void      setOutputFlagPresentFlag(Bool b)  { m_OutputFlagPresentFlag = b;}
-
-    Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag;}
-
-    Void      setTransquantBypassEnableFlag(Bool b) { m_TransquantBypassEnableFlag = b;}
-
-    Bool      getTransquantBypassEnableFlag()         { return m_TransquantBypassEnableFlag;}
-
-    Bool      getUseTransformSkip()         { return m_useTransformSkip;}
-
-    Void      setUseTransformSkip(Bool b) { m_useTransformSkip  = b;}
-
-    Void    setLoopFilterAcrossTilesEnabledFlag(Bool b)    { m_loopFilterAcrossTilesEnabledFlag = b;}
-
-    Bool    getLoopFilterAcrossTilesEnabledFlag()          { return m_loopFilterAcrossTilesEnabledFlag;}
-
-    Bool    getDependentSliceSegmentsEnabledFlag() const     { return m_dependentSliceSegmentsEnabledFlag;}
-
-    Void    setDependentSliceSegmentsEnabledFlag(Bool val)   { m_dependentSliceSegmentsEnabledFlag = val;}
-
-    Bool    getTilesEnabledFlag() const                      { return m_tilesEnabledFlag;}
-
-    Void    setTilesEnabledFlag(Bool val)                    { m_tilesEnabledFlag = val;}
-
-    Bool    getEntropyCodingSyncEnabledFlag() const          { return m_entropyCodingSyncEnabledFlag;}
-
-    Void    setEntropyCodingSyncEnabledFlag(Bool val)        { m_entropyCodingSyncEnabledFlag = val;}
-
-    Void     setUniformSpacingFlag(Bool b)          { m_uniformSpacingFlag = b;}
-
-    Bool     getUniformSpacingFlag()                  { return m_uniformSpacingFlag;}
-
-    Void     setNumColumnsMinus1(Int i)           { m_iNumColumnsMinus1 = i;}
-
-    Int      getNumColumnsMinus1()                  { return m_iNumColumnsMinus1;}
+    Int       getPPSId()      { return m_PPSId; }
+
+    Void      setPPSId(Int i) { m_PPSId = i; }
+
+    Int       getSPSId()      { return m_SPSId; }
+
+    Void      setSPSId(Int i) { m_SPSId = i; }
+
+    Int       getPicInitQPMinus26()         { return m_picInitQPMinus26; }
+
+    Void      setPicInitQPMinus26(Int i)  { m_picInitQPMinus26 = i;     }
+
+    Bool      getUseDQP()                   { return m_useDQP;        }
+
+    Void      setUseDQP(Bool b)           { m_useDQP   = b;         }
+
+    Bool      getConstrainedIntraPred()         { return m_bConstrainedIntraPred; }
+
+    Void      setConstrainedIntraPred(Bool b) { m_bConstrainedIntraPred = b;     }
+
+    Bool      getSliceChromaQpFlag()         { return m_bSliceChromaQpFlag; }
+
+    Void      setSliceChromaQpFlag(Bool b) { m_bSliceChromaQpFlag = b;     }
+
+    Void      setSPS(TComSPS* pcSPS) { m_pcSPS = pcSPS; }
+
+    TComSPS*  getSPS()         { return m_pcSPS;          }
+
+    Void      setMaxCuDQPDepth(UInt u) { m_uiMaxCuDQPDepth = u;   }
+
+    UInt      getMaxCuDQPDepth()         { return m_uiMaxCuDQPDepth; }
+
+    Void      setMinCuDQPSize(UInt u) { m_uiMinCuDQPSize = u;    }
+
+    UInt      getMinCuDQPSize()         { return m_uiMinCuDQPSize; }
+
+    Void      setChromaCbQpOffset(Int i) { m_chromaCbQpOffset = i;    }
+
+    Int       getChromaCbQpOffset()        { return m_chromaCbQpOffset; }
+
+    Void      setChromaCrQpOffset(Int i) { m_chromaCrQpOffset = i;    }
+
+    Int       getChromaCrQpOffset()        { return m_chromaCrQpOffset; }
+
+    Void      setNumRefIdxL0DefaultActive(UInt ui)    { m_numRefIdxL0DefaultActive = ui;     }
+
+    UInt      getNumRefIdxL0DefaultActive()           { return m_numRefIdxL0DefaultActive; }
+
+    Void      setNumRefIdxL1DefaultActive(UInt ui)    { m_numRefIdxL1DefaultActive = ui;     }
+
+    UInt      getNumRefIdxL1DefaultActive()           { return m_numRefIdxL1DefaultActive; }
+
+    Bool getUseWP()          { return m_bUseWeightPred;  }
+
+    Bool getWPBiPred()          { return m_useWeightedBiPred;     }
+
+    Void setUseWP(Bool b)  { m_bUseWeightPred = b;     }
+
+    Void setWPBiPred(Bool b)  { m_useWeightedBiPred = b;  }
+
+    Void      setOutputFlagPresentFlag(Bool b)  { m_OutputFlagPresentFlag = b;    }
+
+    Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
+
+    Void      setTransquantBypassEnableFlag(Bool b) { m_TransquantBypassEnableFlag = b; }
+
+    Bool      getTransquantBypassEnableFlag()         { return m_TransquantBypassEnableFlag; }
+
+    Bool      getUseTransformSkip()         { return m_useTransformSkip;     }
+
+    Void      setUseTransformSkip(Bool b) { m_useTransformSkip  = b;       }
+
+    Void    setLoopFilterAcrossTilesEnabledFlag(Bool b)    { m_loopFilterAcrossTilesEnabledFlag = b; }
+
+    Bool    getLoopFilterAcrossTilesEnabledFlag()          { return m_loopFilterAcrossTilesEnabledFlag;   }
+
+    Bool    getDependentSliceSegmentsEnabledFlag() const     { return m_dependentSliceSegmentsEnabledFlag; }
+
+    Void    setDependentSliceSegmentsEnabledFlag(Bool val)   { m_dependentSliceSegmentsEnabledFlag = val; }
+
+    Bool    getTilesEnabledFlag() const                      { return m_tilesEnabledFlag; }
+
+    Void    setTilesEnabledFlag(Bool val)                    { m_tilesEnabledFlag = val; }
+
+    Bool    getEntropyCodingSyncEnabledFlag() const          { return m_entropyCodingSyncEnabledFlag; }
+
+    Void    setEntropyCodingSyncEnabledFlag(Bool val)        { m_entropyCodingSyncEnabledFlag = val; }
+
+    Void     setUniformSpacingFlag(Bool b)          { m_uniformSpacingFlag = b; }
+
+    Bool     getUniformSpacingFlag()                  { return m_uniformSpacingFlag; }
+
+    Void     setNumColumnsMinus1(Int i)           { m_iNumColumnsMinus1 = i; }
+
+    Int      getNumColumnsMinus1()                  { return m_iNumColumnsMinus1; }
 
     Void     setColumnWidth(UInt* columnWidth)
     {
@@ -1463,11 +1449,11 @@ public:
         }
     }
 
-    UInt     getColumnWidth(UInt columnIdx) { return *(m_puiColumnWidth + columnIdx);}
-
-    Void     setNumRowsMinus1(Int i)        { m_iNumRowsMinus1 = i;}
-
-    Int      getNumRowsMinus1()               { return m_iNumRowsMinus1;}
+    UInt     getColumnWidth(UInt columnIdx) { return *(m_puiColumnWidth + columnIdx); }
+
+    Void     setNumRowsMinus1(Int i)        { m_iNumRowsMinus1 = i; }
+
+    Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
 
     Void     setRowHeight(UInt* rowHeight)
     {
@@ -1482,70 +1468,70 @@ public:
         }
     }
 
-    UInt     getRowHeight(UInt rowIdx)    { return *(m_puiRowHeight + rowIdx);}
-
-    Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams;}
-
-    Int      getNumSubstreams()                                 { return m_iNumSubstreams;}
-
-    Void      setSignHideFlag(Int signHideFlag) { m_signHideFlag = signHideFlag;}
-
-    Int       getSignHideFlag()                    { return m_signHideFlag;}
-
-    Void     setCabacInitPresentFlag(Bool flag)     { m_cabacInitPresentFlag = flag;}
-
-    Void     setEncCABACTableIdx(Int idx)           { m_encCABACTableIdx = idx;}
-
-    Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;}
-
-    UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;}
-
-    Void     setDeblockingFilterControlPresentFlag(Bool val)  { m_deblockingFilterControlPresentFlag = val;}
-
-    Bool     getDeblockingFilterControlPresentFlag()            { return m_deblockingFilterControlPresentFlag;}
-
-    Void     setDeblockingFilterOverrideEnabledFlag(Bool val) { m_deblockingFilterOverrideEnabledFlag = val;}
-
-    Bool     getDeblockingFilterOverrideEnabledFlag()           { return m_deblockingFilterOverrideEnabledFlag;}
-
-    Void     setPicDisableDeblockingFilterFlag(Bool val)        { m_picDisableDeblockingFilterFlag = val;}      //!< set offset for deblocking filter disabled
-
-    Bool     getPicDisableDeblockingFilterFlag()                { return m_picDisableDeblockingFilterFlag;}     //!< get offset for deblocking filter disabled
-
-    Void     setDeblockingFilterBetaOffsetDiv2(Int val)         { m_deblockingFilterBetaOffsetDiv2 = val;}      //!< set beta offset for deblocking filter
-
-    Int      getDeblockingFilterBetaOffsetDiv2()                { return m_deblockingFilterBetaOffsetDiv2;}     //!< get beta offset for deblocking filter
-
-    Void     setDeblockingFilterTcOffsetDiv2(Int val)           { m_deblockingFilterTcOffsetDiv2 = val;}              //!< set tc offset for deblocking filter
-
-    Int      getDeblockingFilterTcOffsetDiv2()                  { return m_deblockingFilterTcOffsetDiv2;}             //!< get tc offset for deblocking filter
-
-    Bool     getScalingListPresentFlag()         { return m_scalingListPresentFlag;}
-
-    Void     setScalingListPresentFlag(Bool b) { m_scalingListPresentFlag  = b;}
+    UInt     getRowHeight(UInt rowIdx)    { return *(m_puiRowHeight + rowIdx); }
+
+    Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
+
+    Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
+
+    Void      setSignHideFlag(Int signHideFlag) { m_signHideFlag = signHideFlag; }