Index: /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 193)
@@ -51,31 +51,31 @@
 DecodingRefreshType       : 1                                      # Random Accesss 0:none, 1:CDR, 2:IDR
 GOPSize                   : 8                                      # GOP Size (number of B slice = GOPSize-1)
-# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos
-Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0
-Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0
-Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0
-Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0
-Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0
-Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0
-Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0
-Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0
-FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0
-Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0 
-Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0 
-Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0  
-Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0  
-Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0  
-Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0  
-Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0  
-Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0  
-FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0  
-Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0  
-Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0  
-Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0  
-Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0  
-Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0  
-Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0  
-Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0  
-Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0  
+# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos          #VSP_ref_pics  VSP_ref_pics  VSP_ref_list_pos
+Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0                                                         0
+Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0                                                         0
+Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0                                                         0
+Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0                                                         0
+Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0                                                         0
+Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0                                                         0
+FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0     1              -1            2                 0
+Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0     1              -1            3                 0
+Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0     1              -1            3                 0
+Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0     1              -1            3                 0
+Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0     1              -1            3                 0
+Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 0
+Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 0
+Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0     1              -1            4                 0
+Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 0
+FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0     1              -2            2                 0
+Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0     1              -2            3                 0
+Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0     1              -2            3                 0
+Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0     1              -2            3                 0
+Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0     1              -2            3                 0
+Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 0
+Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 0
+Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0     1              -2            4                 0
+Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 0
 
 ListCombination           : 1                                      # Use combined list for uni-prediction in B-slices
@@ -203,6 +203,17 @@
 
 
+#========== texture coding tools based on depth ==========
+VSP                       : 1
+VSPDepthDisable           : 0
+
 #========== view synthesis optimization (VSO) ==========
 VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) I(s0.25 s0.5 s0.75)]  # VSO configuration string
+WVSO                      : 0
+VSOWeight                 : 10
+VSDWeight                 : 1
+DWeight                   : 1
+
+#========== Non-normative encoder techniques ==========
+DPL                       : 0
 
 #============ Misc. ================
Index: /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 193)
@@ -55,31 +55,31 @@
 DecodingRefreshType       : 1                                      # Random Accesss 0:none, 1:CDR, 2:IDR
 GOPSize                   : 8                                      # GOP Size (number of B slice = GOPSize-1)
-# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos
-Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0
-Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0
-Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0
-Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0
-Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0
-Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0
-Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0
-Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0
-FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0
-Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0 
-Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0 
-Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0  
-Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0  
-Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0  
-Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0  
-Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0  
-Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0  
-FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0  
-Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0  
-Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0  
-Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0  
-Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0  
-Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0  
-Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0  
-Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0  
-Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0  
+# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos          #VSP_ref_pics  VSP_ref_pics  VSP_ref_list_pos
+Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0                                                         0
+Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0                                                         0
+Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0                                                         0
+Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0                                                         0
+Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0                                                         0
+Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0                                                         0
+FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0     1              -1            2                 0
+Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0     1              -1            3                 0
+Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0     1              -1            3                 0
+Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0     1              -1            3                 0
+Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0     1              -1            3                 0
+Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 0
+Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 0
+Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0     1              -1            4                 0
+Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 0
+FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0     1              -2            2                 0
+Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0     1              -2            3                 0
+Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0     1              -2            3                 0
+Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0     1              -2            3                 0
+Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0     1              -2            3                 0
+Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 0
+Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 0
+Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0     1              -2            4                 0
+Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 0
 
 ListCombination           : 1                                      # Use combined list for uni-prediction in B-slices
@@ -206,7 +206,18 @@
 VSO                       : 1                                      # use of view synthesis optimization for depth coding
 
+#========== texture coding tools based on depth ==========
+VSP                       : 1
+VSPDepthDisable           : 0
 
 #========== view synthesis optimization (VSO) ==========
 VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
+WVSO                      : 0
+VSOWeight                 : 10
+VSDWeight                 : 1
+DWeight                   : 1
+
+#========== Non-normative encoder techniques ==========
+DPL                       : 0
+
 #============ Misc. ================
 SEIpictureDigest          : 0                                      # Control generation of picture_digest SEI messages
Index: /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_a_texture+depth.All.cfg
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_a_texture+depth.All.cfg	(revision 193)
+++ /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_a_texture+depth.All.cfg	(revision 193)
@@ -0,0 +1,220 @@
+
+#========== file i/o ==========
+InputFile_0               : org_0.yuv                              # video input file for view 0
+InputFile_1               : org_1.yuv                              # video input file for view 1
+InputFile_2               : org_2.yuv                              # video input file for view 2
+
+DepthInputFile_0          : org_depth_0.yuv                        # depth input file for view 0
+DepthInputFile_1          : org_depth_1.yuv                        # depth input file for view 1
+DepthInputFile_2          : org_depth_2.yuv                        # depth input file for view 2
+
+ReconFile_0               : rec_0.yuv                              # video output file for view 0
+ReconFile_1               : rec_1.yuv                              # video output file for view 1
+ReconFile_2               : rec_2.yuv                              # video output file for view 2
+
+DepthReconFile_0          : rec_depth_0.yuv                        # depth output file for view 0
+DepthReconFile_1          : rec_depth_1.yuv                        # depth output file for view 1
+DepthReconFile_2          : rec_depth_2.yuv                        # depth output file for view 2
+
+BitstreamFile             : stream.bit                             # bitstream file
+
+#========== general coding parameters ==========
+NumberOfViews             : 3                                      # number of views to be coded
+CodeDepthMaps             : 1                                      # encode depth maps
+FrameSkip                 : 0                                      # number of frames to be skipped at beginning of input sequences
+InputBitDepth             : 8                                      # bit depth of input files
+OutputBitDepth            : 8                                      # bit depth of output files
+InternalBitDepth          : 8                                      # internal bit depth used for coding
+
+CroppingMode              : 0                                      # Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping)
+CropLeft                  : 0                                      # Left cropping/padding for cropping mode 3
+CropRight                 : 0                                      # Right cropping/padding for cropping mode 3
+CropTop                   : 0                                      # Top cropping/padding for cropping mode 3
+CropBottom                : 0                                      # Bottom cropping/padding for cropping mode 3
+HorizontalPadding         : 0                                      # horizontal source padding for cropping mode 2
+VerticalPadding           : 0                                      # vertical source padding for cropping mode 2
+
+
+#========== camera parameters ==========
+CameraParameterFile       : cam_pars.txt                           # camera parameter file
+CodedCamParsPrecision     : 5                                      # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
+
+
+#========== coding unit definitions ==========
+MaxCUWidth                : 64                                     # maximum coding unit witdh  (in luma samples) 
+MaxCUHeight               : 64                                     # maximum coding unit height (in luma samples)
+MaxPartitionDepth         : 4                                      # maximum coding unit depth
+QuadtreeTULog2MaxSize     : 5                                      # log2 of maximum transform size
+QuadtreeTULog2MinSize     : 2                                      # log2 of minimum transform size
+QuadtreeTUMaxDepthIntra   : 3                                      # maximum transform tree depth for intra-coded CU's
+QuadtreeTUMaxDepthInter   : 3                                      # maximum transform tree depth for inter-coded CU's
+
+
+#========== coding structure ==========
+IntraPeriod               : 24                                     # Period of I-Frame ( -1 = only first)
+DecodingRefreshType       : 1                                      # Random Accesss 0:none, 1:CDR, 2:IDR
+GOPSize                   : 8                                      # GOP Size (number of B slice = GOPSize-1)
+# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos
+Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0                                                         0
+Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0                                                         0
+Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0                                                         0
+Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0                                                         0
+Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0                                                         0
+Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0                                                         0
+FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0     1              -1            2                 0
+Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0     1              -1            3                 3
+Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0     1              -1            4                 4
+Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0     1              -1            4                 4
+Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0     1              -1            4                 4
+Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0     1              -1            4                 4
+Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0     1              -2            2                 0
+Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0     1              -2            3                 3
+Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0     1              -2            4                 4
+Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0     1              -2            4                 4
+Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0     1              -2            4                 4
+Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0     1              -2            4                 4
+Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+
+ListCombination           : 1                                      # Use combined list for uni-prediction in B-slices
+LCModification            : 0                                      # enables signalling of combined reference list derivation
+DisableInter4x4           : 1                                      # Disable Inter4x4 (1: Disable Inter4x4, 0: Enable Inter4x4)
+
+
+#========== encoder control /motion search ==========
+FastSearch                : 1                                      # motion search mode (0:Full search, 1:Diamond, 2:PMVFAST)
+SearchRange               : 96                                     # motion search range (in luma samples)
+BipredSearchRange         : 4                                      # motion search range for bi-prediction refinement (in luma samples)
+HadamardME                : 1                                      # use Hadamard SAD for fractional-sample search
+FEN                       : 1                                      # use fast encoder control
+FDM                       : 1                                      # Fast Decision for Merge RD cost
+TMVP                      : 1                                      # Enable TMVP
+ECU                       : 0                                      # Early CU setting
+CFM                       : 0                                      # Cbf fast mode setting
+SBACRD                    : 1                                      # SBAC based RD estimation
+ASR                       : 0                                      # adaptive motion search range
+
+
+#========== quantization ==========
+DeltaQpRD                 : 0                                      # maximum delta QP offset for a slice
+MaxDeltaQP                : 0                                      # maximum delta QP offset for a block
+MaxCuDQPDepth             : 0                                      # max depth of a minimum CuDQP for sub-LCU-level delta QP
+RDOQ                      : 1 1                                    # use rate-distortion optimized quantization (RDOQ)
+ChromaQpOffset            : 0                                      # ChromaQPOffset
+ChromaQpOffset2nd         : 0                                      # ChromaQPOffset2nd
+AdaptiveQpSelection       : 0                                      # AdaptiveQpSelection
+AdaptiveQP                : 0                                      # QP adaptation based on a psycho-visual model
+MaxQPAdaptationRange      : 6                                      # QP adaptation range
+LambdaModifier0           : 1.0                                    # Lambda modifier for temporal layer 0
+LambdaModifier1           : 1.0                                    # Lambda modifier for temporal layer 1
+LambdaModifier2           : 1.0                                    # Lambda modifier for temporal layer 2
+LambdaModifier3           : 1.0                                    # Lambda modifier for temporal layer 3
+
+
+#=========== Quantization Matrix =================
+ScalingList               : 0                                      # ScalingList 0 : off, 1 : default, 2 : file read
+# ScalingListFile         :                                        # Scaling List file name. If file is not exist, use Default Matrix.
+
+
+#============ Lossless ================
+LosslessCuEnabled         : 0                                      # 1: Set "qpprime_y_zero_transquant_bypass_flag=1" and enable the lossless mode as well as the RD-based mode selection process.
+
+
+#========== slices ==========
+SliceGranularity          : 0                                      # Slice granularity relative the LCU size
+SliceMode                 : 0                                      # slice mode (0:off, 1:max # of LCUs, 2:max # of bytes)
+SliceArgument             : 1500                                   # slice argument (SliceMode1:max # of LCUs, SliceMode2: max # of bytes)
+EntropySliceMode          : 0                                      # entropy slices (0:off, 1:max # of LCUs, 2:max # of bins)
+EntropySliceArgument      : 180000                                 # entropy slice argument (EntropySliceMode1:max # of LCUs, EntropySliceMode2:max # of bins)
+LFCrossSliceBoundaryFlag  : 1                                      # loop-filtering across slice boundaries
+
+
+#========== deblocking ==========
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
+LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
+LoopFilterDisable              : 0 1                               # disable deblocking filter
+LoopFilterBetaOffset_div2      : 0                                 # Range: -13 ~ 13
+LoopFilterTcOffset_div2        : 0                                 # Range: -13 ~ 13
+
+
+#========== coding tools ==========
+ALFEncodePassReduction         : 0                                 # ALF encoding (0:original 16-pass, 1:one-pass, 2:two-pass)
+SAO                            : 1 0                               # Sample adaptive offset  (0: OFF, 1: ON)
+ALF                            : 0 0                               # Adaptive loop filter  (0: OFF, 1: ON)
+LMChroma                       : 0                                 # Chroma from luma intra prediction mode (0: OFF, 1: ON)
+NSQT                           : 0                                 # Non-square transforms (0: OFF, 1: ON)
+AMP                            : 0                                 # Asymmetric motion partitions (0: OFF, 1: ON)
+ALFMaxNumFilter                : 16                                # ALF Max Number Filters per picture
+ALFParamInSlice                : 0                                 # ALF params in SliceHeader or APS (0=APS, 1=SliceHeader)
+ALFPicBasedEncode              : 1                                 # ALF LCU-based or picture-based encoding (0: LCU-based, 1: Picture-based)  
+MaxNumOffsetsPerPic            : 2048                              # default
+SAOInterleaving                : 0                                 # SAO interleaving flag (0: SAO parameter in APS, 1: SAO parameter in slice data) 
+ConstrainedIntraPred           : 0                                 # Constrained Intra Prediction
+weighted_pred_flag             : 0                                 # weighted prediction flag (P-Slices)
+weighted_bipred_idc            : 0                                 # weighted bipred idc (B-Slices)
+SignHideFlag                   : 1                                 # sign hiding
+SignHideThreshold              : 4                                 # sign hiding threshold
+
+
+#============ PCM ================
+PCMEnabledFlag                 : 0                                 # 0: No PCM mode
+PCMLog2MaxSize                 : 5                                 # Log2 of maximum PCM block size.
+PCMLog2MinSize                 : 3                                 # Log2 of minimum PCM block size.
+PCMInputBitDepthFlag           : 1                                 # 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
+PCMFilterDisableFlag           : 0                                 # 0: Enable loop filtering on I_PCM samples. 1: Disable loop filtering on I_PCM samples.
+
+
+#============ Tiles ================
+TileInfoPresentFlag            : 1                                 # 0: tiles parameters are NOT present in the PPS, 1: tiles parameters are present in the PPS 
+UniformSpacingIdc              : 0                                 # 0: the column boundaries are indicated by ColumnWidth array, the row boundaries are indicated by RowHeight array, 1: the column and row boundaries are distributed uniformly
+NumTileColumnsMinus1           : 0                                 # Number of columns in a picture minus 1
+ColumnWidthArray               : 2 3                               # Array containing ColumnWidth values in units of LCU (from left to right in picture)   
+NumTileRowsMinus1              : 0                                 # Number of rows in a picture minus 1
+RowHeightArray                 : 2                                 #  Array containing RowHeight values in units of LCU (from top to bottom in picture)
+TileLocationInSliceHeaderFlag  : 0                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile location information to slice header, 0: Disable writing tile location information to slice header.
+TileMarkerFlag                 : 1                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile markers, 0: Disable writing tile markers.
+MaxTileMarkerEntryPoints       : 4                                 # Maximum number of uniformly-spaced tile entry points (using tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.
+TileControlPresentFlag         : 1                                 # 0: tiles behavior control parameters are NOT present in the PPS,  1: tiles behavior control parameters are present in the PPS
+LFCrossTileBoundaryFlag        : 1                                 # In-loop filtering is across or not across tile boundary.  0:not across, 1: across                                                       
+
+
+#============ WaveFront ================
+WaveFrontSynchro               : 0                                 # 0:  No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case), >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
+WaveFrontFlush                 : 0                                 # 0: No CABAC resets are performed, 1: A CABAC reset is performed at the end of each LCU line.
+WaveFrontSubstreams            : 1                                 # >0: This many substreams per slice (or per tile if TileBoundaryIndependenceIdc=1) will be produced.
+
+
+#========== multiview coding tools ==========
+PredDepthMapGen           : 1                                      # generation of prediction depth maps (0:off, 1:using coded motion data, 2:using coded depth maps)
+MultiviewMvPred           : 7                                      # usage of prediction depth maps (0:off, 1:for interview, 2:for inter, 4:for merge, X:bit-wise combinations)
+MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
+MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
+MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+InterViewSkip             : 0                                      # interview SKIP mode
+InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
+
+
+#========== depth coding tools ==========
+DMM                       : 1                                      # use depth intra modes (wedgelets)
+MVI                       : 1                                      # motion parameter inheritance
+VSO                       : 1                                      # use of view synthesis optimization for depth coding
+
+
+#========== texture coding tools based on depth ==========
+VSP                       : 1
+VSPDepthDisable           : 0
+
+
+#========== view synthesis optimization (VSO) ==========
+VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
+
+#============ Misc. ================
+SEIpictureDigest          : 0                                      # Control generation of picture_digest SEI messages
+
+
Index: /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_b_texture+depth.RefOnly.cfg
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_b_texture+depth.RefOnly.cfg	(revision 193)
+++ /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_b_texture+depth.RefOnly.cfg	(revision 193)
@@ -0,0 +1,220 @@
+
+#========== file i/o ==========
+InputFile_0               : org_0.yuv                              # video input file for view 0
+InputFile_1               : org_1.yuv                              # video input file for view 1
+InputFile_2               : org_2.yuv                              # video input file for view 2
+
+DepthInputFile_0          : org_depth_0.yuv                        # depth input file for view 0
+DepthInputFile_1          : org_depth_1.yuv                        # depth input file for view 1
+DepthInputFile_2          : org_depth_2.yuv                        # depth input file for view 2
+
+ReconFile_0               : rec_0.yuv                              # video output file for view 0
+ReconFile_1               : rec_1.yuv                              # video output file for view 1
+ReconFile_2               : rec_2.yuv                              # video output file for view 2
+
+DepthReconFile_0          : rec_depth_0.yuv                        # depth output file for view 0
+DepthReconFile_1          : rec_depth_1.yuv                        # depth output file for view 1
+DepthReconFile_2          : rec_depth_2.yuv                        # depth output file for view 2
+
+BitstreamFile             : stream.bit                             # bitstream file
+
+#========== general coding parameters ==========
+NumberOfViews             : 3                                      # number of views to be coded
+CodeDepthMaps             : 1                                      # encode depth maps
+FrameSkip                 : 0                                      # number of frames to be skipped at beginning of input sequences
+InputBitDepth             : 8                                      # bit depth of input files
+OutputBitDepth            : 8                                      # bit depth of output files
+InternalBitDepth          : 8                                      # internal bit depth used for coding
+
+CroppingMode              : 0                                      # Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping)
+CropLeft                  : 0                                      # Left cropping/padding for cropping mode 3
+CropRight                 : 0                                      # Right cropping/padding for cropping mode 3
+CropTop                   : 0                                      # Top cropping/padding for cropping mode 3
+CropBottom                : 0                                      # Bottom cropping/padding for cropping mode 3
+HorizontalPadding         : 0                                      # horizontal source padding for cropping mode 2
+VerticalPadding           : 0                                      # vertical source padding for cropping mode 2
+
+
+#========== camera parameters ==========
+CameraParameterFile       : cam_pars.txt                           # camera parameter file
+CodedCamParsPrecision     : 5                                      # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
+
+
+#========== coding unit definitions ==========
+MaxCUWidth                : 64                                     # maximum coding unit witdh  (in luma samples) 
+MaxCUHeight               : 64                                     # maximum coding unit height (in luma samples)
+MaxPartitionDepth         : 4                                      # maximum coding unit depth
+QuadtreeTULog2MaxSize     : 5                                      # log2 of maximum transform size
+QuadtreeTULog2MinSize     : 2                                      # log2 of minimum transform size
+QuadtreeTUMaxDepthIntra   : 3                                      # maximum transform tree depth for intra-coded CU's
+QuadtreeTUMaxDepthInter   : 3                                      # maximum transform tree depth for inter-coded CU's
+
+
+#========== coding structure ==========
+IntraPeriod               : 24                                     # Period of I-Frame ( -1 = only first)
+DecodingRefreshType       : 1                                      # Random Accesss 0:none, 1:CDR, 2:IDR
+GOPSize                   : 8                                      # GOP Size (number of B slice = GOPSize-1)
+# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos
+Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0                                                         0
+Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0                                                         0
+Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0                                                         0
+Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0                                                         0
+Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0                                                         0
+Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0                                                         0
+FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0     1              -1            2                 0
+Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0     1              -1            3                 3
+Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0     1              -1            4                 4
+Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0     1              -1            4                 4
+Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0     0
+Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     0
+Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0     0
+Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     0
+FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0     1              -2            2                 0
+Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0     1              -2            3                 3
+Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0     1              -2            4                 4
+Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0     1              -2            4                 4
+Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0     0
+Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     0
+Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0     0
+Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     0
+
+ListCombination           : 1                                      # Use combined list for uni-prediction in B-slices
+LCModification            : 0                                      # enables signalling of combined reference list derivation
+DisableInter4x4           : 1                                      # Disable Inter4x4 (1: Disable Inter4x4, 0: Enable Inter4x4)
+
+
+#========== encoder control /motion search ==========
+FastSearch                : 1                                      # motion search mode (0:Full search, 1:Diamond, 2:PMVFAST)
+SearchRange               : 96                                     # motion search range (in luma samples)
+BipredSearchRange         : 4                                      # motion search range for bi-prediction refinement (in luma samples)
+HadamardME                : 1                                      # use Hadamard SAD for fractional-sample search
+FEN                       : 1                                      # use fast encoder control
+FDM                       : 1                                      # Fast Decision for Merge RD cost
+TMVP                      : 1                                      # Enable TMVP
+ECU                       : 0                                      # Early CU setting
+CFM                       : 0                                      # Cbf fast mode setting
+SBACRD                    : 1                                      # SBAC based RD estimation
+ASR                       : 0                                      # adaptive motion search range
+
+
+#========== quantization ==========
+DeltaQpRD                 : 0                                      # maximum delta QP offset for a slice
+MaxDeltaQP                : 0                                      # maximum delta QP offset for a block
+MaxCuDQPDepth             : 0                                      # max depth of a minimum CuDQP for sub-LCU-level delta QP
+RDOQ                      : 1 1                                    # use rate-distortion optimized quantization (RDOQ)
+ChromaQpOffset            : 0                                      # ChromaQPOffset
+ChromaQpOffset2nd         : 0                                      # ChromaQPOffset2nd
+AdaptiveQpSelection       : 0                                      # AdaptiveQpSelection
+AdaptiveQP                : 0                                      # QP adaptation based on a psycho-visual model
+MaxQPAdaptationRange      : 6                                      # QP adaptation range
+LambdaModifier0           : 1.0                                    # Lambda modifier for temporal layer 0
+LambdaModifier1           : 1.0                                    # Lambda modifier for temporal layer 1
+LambdaModifier2           : 1.0                                    # Lambda modifier for temporal layer 2
+LambdaModifier3           : 1.0                                    # Lambda modifier for temporal layer 3
+
+
+#=========== Quantization Matrix =================
+ScalingList               : 0                                      # ScalingList 0 : off, 1 : default, 2 : file read
+# ScalingListFile         :                                        # Scaling List file name. If file is not exist, use Default Matrix.
+
+
+#============ Lossless ================
+LosslessCuEnabled         : 0                                      # 1: Set "qpprime_y_zero_transquant_bypass_flag=1" and enable the lossless mode as well as the RD-based mode selection process.
+
+
+#========== slices ==========
+SliceGranularity          : 0                                      # Slice granularity relative the LCU size
+SliceMode                 : 0                                      # slice mode (0:off, 1:max # of LCUs, 2:max # of bytes)
+SliceArgument             : 1500                                   # slice argument (SliceMode1:max # of LCUs, SliceMode2: max # of bytes)
+EntropySliceMode          : 0                                      # entropy slices (0:off, 1:max # of LCUs, 2:max # of bins)
+EntropySliceArgument      : 180000                                 # entropy slice argument (EntropySliceMode1:max # of LCUs, EntropySliceMode2:max # of bins)
+LFCrossSliceBoundaryFlag  : 1                                      # loop-filtering across slice boundaries
+
+
+#========== deblocking ==========
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
+LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
+LoopFilterDisable              : 0 1                               # disable deblocking filter
+LoopFilterBetaOffset_div2      : 0                                 # Range: -13 ~ 13
+LoopFilterTcOffset_div2        : 0                                 # Range: -13 ~ 13
+
+
+#========== coding tools ==========
+ALFEncodePassReduction         : 0                                 # ALF encoding (0:original 16-pass, 1:one-pass, 2:two-pass)
+SAO                            : 1 0                               # Sample adaptive offset  (0: OFF, 1: ON)
+ALF                            : 0 0                               # Adaptive loop filter  (0: OFF, 1: ON)
+LMChroma                       : 0                                 # Chroma from luma intra prediction mode (0: OFF, 1: ON)
+NSQT                           : 0                                 # Non-square transforms (0: OFF, 1: ON)
+AMP                            : 0                                 # Asymmetric motion partitions (0: OFF, 1: ON)
+ALFMaxNumFilter                : 16                                # ALF Max Number Filters per picture
+ALFParamInSlice                : 0                                 # ALF params in SliceHeader or APS (0=APS, 1=SliceHeader)
+ALFPicBasedEncode              : 1                                 # ALF LCU-based or picture-based encoding (0: LCU-based, 1: Picture-based)  
+MaxNumOffsetsPerPic            : 2048                              # default
+SAOInterleaving                : 0                                 # SAO interleaving flag (0: SAO parameter in APS, 1: SAO parameter in slice data) 
+ConstrainedIntraPred           : 0                                 # Constrained Intra Prediction
+weighted_pred_flag             : 0                                 # weighted prediction flag (P-Slices)
+weighted_bipred_idc            : 0                                 # weighted bipred idc (B-Slices)
+SignHideFlag                   : 1                                 # sign hiding
+SignHideThreshold              : 4                                 # sign hiding threshold
+
+
+#============ PCM ================
+PCMEnabledFlag                 : 0                                 # 0: No PCM mode
+PCMLog2MaxSize                 : 5                                 # Log2 of maximum PCM block size.
+PCMLog2MinSize                 : 3                                 # Log2 of minimum PCM block size.
+PCMInputBitDepthFlag           : 1                                 # 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
+PCMFilterDisableFlag           : 0                                 # 0: Enable loop filtering on I_PCM samples. 1: Disable loop filtering on I_PCM samples.
+
+
+#============ Tiles ================
+TileInfoPresentFlag            : 1                                 # 0: tiles parameters are NOT present in the PPS, 1: tiles parameters are present in the PPS 
+UniformSpacingIdc              : 0                                 # 0: the column boundaries are indicated by ColumnWidth array, the row boundaries are indicated by RowHeight array, 1: the column and row boundaries are distributed uniformly
+NumTileColumnsMinus1           : 0                                 # Number of columns in a picture minus 1
+ColumnWidthArray               : 2 3                               # Array containing ColumnWidth values in units of LCU (from left to right in picture)   
+NumTileRowsMinus1              : 0                                 # Number of rows in a picture minus 1
+RowHeightArray                 : 2                                 #  Array containing RowHeight values in units of LCU (from top to bottom in picture)
+TileLocationInSliceHeaderFlag  : 0                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile location information to slice header, 0: Disable writing tile location information to slice header.
+TileMarkerFlag                 : 1                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile markers, 0: Disable writing tile markers.
+MaxTileMarkerEntryPoints       : 4                                 # Maximum number of uniformly-spaced tile entry points (using tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.
+TileControlPresentFlag         : 1                                 # 0: tiles behavior control parameters are NOT present in the PPS,  1: tiles behavior control parameters are present in the PPS
+LFCrossTileBoundaryFlag        : 1                                 # In-loop filtering is across or not across tile boundary.  0:not across, 1: across                                                       
+
+
+#============ WaveFront ================
+WaveFrontSynchro               : 0                                 # 0:  No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case), >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
+WaveFrontFlush                 : 0                                 # 0: No CABAC resets are performed, 1: A CABAC reset is performed at the end of each LCU line.
+WaveFrontSubstreams            : 1                                 # >0: This many substreams per slice (or per tile if TileBoundaryIndependenceIdc=1) will be produced.
+
+
+#========== multiview coding tools ==========
+PredDepthMapGen           : 1                                      # generation of prediction depth maps (0:off, 1:using coded motion data, 2:using coded depth maps)
+MultiviewMvPred           : 7                                      # usage of prediction depth maps (0:off, 1:for interview, 2:for inter, 4:for merge, X:bit-wise combinations)
+MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
+MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
+MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+InterViewSkip             : 0                                      # interview SKIP mode
+InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
+
+
+#========== depth coding tools ==========
+DMM                       : 1                                      # use depth intra modes (wedgelets)
+MVI                       : 1                                      # motion parameter inheritance
+VSO                       : 1                                      # use of view synthesis optimization for depth coding
+
+
+#========== texture coding tools based on depth ==========
+VSP                       : 1
+VSPDepthDisable           : 0
+
+
+#========== view synthesis optimization (VSO) ==========
+VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
+
+#============ Misc. ================
+SEIpictureDigest          : 0                                      # Control generation of picture_digest SEI messages
+
+
Index: /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_c_textureOnly.All.cfg
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_c_textureOnly.All.cfg	(revision 193)
+++ /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_c_textureOnly.All.cfg	(revision 193)
@@ -0,0 +1,220 @@
+
+#========== file i/o ==========
+InputFile_0               : org_0.yuv                              # video input file for view 0
+InputFile_1               : org_1.yuv                              # video input file for view 1
+InputFile_2               : org_2.yuv                              # video input file for view 2
+
+DepthInputFile_0          : org_depth_0.yuv                        # depth input file for view 0
+DepthInputFile_1          : org_depth_1.yuv                        # depth input file for view 1
+DepthInputFile_2          : org_depth_2.yuv                        # depth input file for view 2
+
+ReconFile_0               : rec_0.yuv                              # video output file for view 0
+ReconFile_1               : rec_1.yuv                              # video output file for view 1
+ReconFile_2               : rec_2.yuv                              # video output file for view 2
+
+DepthReconFile_0          : rec_depth_0.yuv                        # depth output file for view 0
+DepthReconFile_1          : rec_depth_1.yuv                        # depth output file for view 1
+DepthReconFile_2          : rec_depth_2.yuv                        # depth output file for view 2
+
+BitstreamFile             : stream.bit                             # bitstream file
+
+#========== general coding parameters ==========
+NumberOfViews             : 3                                      # number of views to be coded
+CodeDepthMaps             : 1                                      # encode depth maps
+FrameSkip                 : 0                                      # number of frames to be skipped at beginning of input sequences
+InputBitDepth             : 8                                      # bit depth of input files
+OutputBitDepth            : 8                                      # bit depth of output files
+InternalBitDepth          : 8                                      # internal bit depth used for coding
+
+CroppingMode              : 0                                      # Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping)
+CropLeft                  : 0                                      # Left cropping/padding for cropping mode 3
+CropRight                 : 0                                      # Right cropping/padding for cropping mode 3
+CropTop                   : 0                                      # Top cropping/padding for cropping mode 3
+CropBottom                : 0                                      # Bottom cropping/padding for cropping mode 3
+HorizontalPadding         : 0                                      # horizontal source padding for cropping mode 2
+VerticalPadding           : 0                                      # vertical source padding for cropping mode 2
+
+
+#========== camera parameters ==========
+CameraParameterFile       : cam_pars.txt                           # camera parameter file
+CodedCamParsPrecision     : 5                                      # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
+
+
+#========== coding unit definitions ==========
+MaxCUWidth                : 64                                     # maximum coding unit witdh  (in luma samples) 
+MaxCUHeight               : 64                                     # maximum coding unit height (in luma samples)
+MaxPartitionDepth         : 4                                      # maximum coding unit depth
+QuadtreeTULog2MaxSize     : 5                                      # log2 of maximum transform size
+QuadtreeTULog2MinSize     : 2                                      # log2 of minimum transform size
+QuadtreeTUMaxDepthIntra   : 3                                      # maximum transform tree depth for intra-coded CU's
+QuadtreeTUMaxDepthInter   : 3                                      # maximum transform tree depth for inter-coded CU's
+
+
+#========== coding structure ==========
+IntraPeriod               : 24                                     # Period of I-Frame ( -1 = only first)
+DecodingRefreshType       : 1                                      # Random Accesss 0:none, 1:CDR, 2:IDR
+GOPSize                   : 8                                      # GOP Size (number of B slice = GOPSize-1)
+# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos
+Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0                                                         0
+Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0                                                         0
+Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0                                                         0
+Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0                                                         0
+Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0                                                         0
+Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0                                                         0
+FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0     1              -1            2                 0
+Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0     1              -1            3                 3
+Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0     1              -1            4                 4
+Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0     1              -1            4                 4
+Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0     1              -1            4                 4
+Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0     1              -1            4                 4
+Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0     1              -2            2                 0
+Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0     1              -2            3                 3
+Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0     1              -2            4                 4
+Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0     1              -2            4                 4
+Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0     1              -2            4                 4
+Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0     1              -2            4                 4
+Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+
+ListCombination           : 1                                      # Use combined list for uni-prediction in B-slices
+LCModification            : 0                                      # enables signalling of combined reference list derivation
+DisableInter4x4           : 1                                      # Disable Inter4x4 (1: Disable Inter4x4, 0: Enable Inter4x4)
+
+
+#========== encoder control /motion search ==========
+FastSearch                : 1                                      # motion search mode (0:Full search, 1:Diamond, 2:PMVFAST)
+SearchRange               : 96                                     # motion search range (in luma samples)
+BipredSearchRange         : 4                                      # motion search range for bi-prediction refinement (in luma samples)
+HadamardME                : 1                                      # use Hadamard SAD for fractional-sample search
+FEN                       : 1                                      # use fast encoder control
+FDM                       : 1                                      # Fast Decision for Merge RD cost
+TMVP                      : 1                                      # Enable TMVP
+ECU                       : 0                                      # Early CU setting
+CFM                       : 0                                      # Cbf fast mode setting
+SBACRD                    : 1                                      # SBAC based RD estimation
+ASR                       : 0                                      # adaptive motion search range
+
+
+#========== quantization ==========
+DeltaQpRD                 : 0                                      # maximum delta QP offset for a slice
+MaxDeltaQP                : 0                                      # maximum delta QP offset for a block
+MaxCuDQPDepth             : 0                                      # max depth of a minimum CuDQP for sub-LCU-level delta QP
+RDOQ                      : 1 1                                    # use rate-distortion optimized quantization (RDOQ)
+ChromaQpOffset            : 0                                      # ChromaQPOffset
+ChromaQpOffset2nd         : 0                                      # ChromaQPOffset2nd
+AdaptiveQpSelection       : 0                                      # AdaptiveQpSelection
+AdaptiveQP                : 0                                      # QP adaptation based on a psycho-visual model
+MaxQPAdaptationRange      : 6                                      # QP adaptation range
+LambdaModifier0           : 1.0                                    # Lambda modifier for temporal layer 0
+LambdaModifier1           : 1.0                                    # Lambda modifier for temporal layer 1
+LambdaModifier2           : 1.0                                    # Lambda modifier for temporal layer 2
+LambdaModifier3           : 1.0                                    # Lambda modifier for temporal layer 3
+
+
+#=========== Quantization Matrix =================
+ScalingList               : 0                                      # ScalingList 0 : off, 1 : default, 2 : file read
+# ScalingListFile         :                                        # Scaling List file name. If file is not exist, use Default Matrix.
+
+
+#============ Lossless ================
+LosslessCuEnabled         : 0                                      # 1: Set "qpprime_y_zero_transquant_bypass_flag=1" and enable the lossless mode as well as the RD-based mode selection process.
+
+
+#========== slices ==========
+SliceGranularity          : 0                                      # Slice granularity relative the LCU size
+SliceMode                 : 0                                      # slice mode (0:off, 1:max # of LCUs, 2:max # of bytes)
+SliceArgument             : 1500                                   # slice argument (SliceMode1:max # of LCUs, SliceMode2: max # of bytes)
+EntropySliceMode          : 0                                      # entropy slices (0:off, 1:max # of LCUs, 2:max # of bins)
+EntropySliceArgument      : 180000                                 # entropy slice argument (EntropySliceMode1:max # of LCUs, EntropySliceMode2:max # of bins)
+LFCrossSliceBoundaryFlag  : 1                                      # loop-filtering across slice boundaries
+
+
+#========== deblocking ==========
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
+LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
+LoopFilterDisable              : 0 1                               # disable deblocking filter
+LoopFilterBetaOffset_div2      : 0                                 # Range: -13 ~ 13
+LoopFilterTcOffset_div2        : 0                                 # Range: -13 ~ 13
+
+
+#========== coding tools ==========
+ALFEncodePassReduction         : 0                                 # ALF encoding (0:original 16-pass, 1:one-pass, 2:two-pass)
+SAO                            : 1 0                               # Sample adaptive offset  (0: OFF, 1: ON)
+ALF                            : 0 0                               # Adaptive loop filter  (0: OFF, 1: ON)
+LMChroma                       : 0                                 # Chroma from luma intra prediction mode (0: OFF, 1: ON)
+NSQT                           : 0                                 # Non-square transforms (0: OFF, 1: ON)
+AMP                            : 0                                 # Asymmetric motion partitions (0: OFF, 1: ON)
+ALFMaxNumFilter                : 16                                # ALF Max Number Filters per picture
+ALFParamInSlice                : 0                                 # ALF params in SliceHeader or APS (0=APS, 1=SliceHeader)
+ALFPicBasedEncode              : 1                                 # ALF LCU-based or picture-based encoding (0: LCU-based, 1: Picture-based)  
+MaxNumOffsetsPerPic            : 2048                              # default
+SAOInterleaving                : 0                                 # SAO interleaving flag (0: SAO parameter in APS, 1: SAO parameter in slice data) 
+ConstrainedIntraPred           : 0                                 # Constrained Intra Prediction
+weighted_pred_flag             : 0                                 # weighted prediction flag (P-Slices)
+weighted_bipred_idc            : 0                                 # weighted bipred idc (B-Slices)
+SignHideFlag                   : 1                                 # sign hiding
+SignHideThreshold              : 4                                 # sign hiding threshold
+
+
+#============ PCM ================
+PCMEnabledFlag                 : 0                                 # 0: No PCM mode
+PCMLog2MaxSize                 : 5                                 # Log2 of maximum PCM block size.
+PCMLog2MinSize                 : 3                                 # Log2 of minimum PCM block size.
+PCMInputBitDepthFlag           : 1                                 # 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
+PCMFilterDisableFlag           : 0                                 # 0: Enable loop filtering on I_PCM samples. 1: Disable loop filtering on I_PCM samples.
+
+
+#============ Tiles ================
+TileInfoPresentFlag            : 1                                 # 0: tiles parameters are NOT present in the PPS, 1: tiles parameters are present in the PPS 
+UniformSpacingIdc              : 0                                 # 0: the column boundaries are indicated by ColumnWidth array, the row boundaries are indicated by RowHeight array, 1: the column and row boundaries are distributed uniformly
+NumTileColumnsMinus1           : 0                                 # Number of columns in a picture minus 1
+ColumnWidthArray               : 2 3                               # Array containing ColumnWidth values in units of LCU (from left to right in picture)   
+NumTileRowsMinus1              : 0                                 # Number of rows in a picture minus 1
+RowHeightArray                 : 2                                 #  Array containing RowHeight values in units of LCU (from top to bottom in picture)
+TileLocationInSliceHeaderFlag  : 0                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile location information to slice header, 0: Disable writing tile location information to slice header.
+TileMarkerFlag                 : 1                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile markers, 0: Disable writing tile markers.
+MaxTileMarkerEntryPoints       : 4                                 # Maximum number of uniformly-spaced tile entry points (using tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.
+TileControlPresentFlag         : 1                                 # 0: tiles behavior control parameters are NOT present in the PPS,  1: tiles behavior control parameters are present in the PPS
+LFCrossTileBoundaryFlag        : 1                                 # In-loop filtering is across or not across tile boundary.  0:not across, 1: across                                                       
+
+
+#============ WaveFront ================
+WaveFrontSynchro               : 0                                 # 0:  No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case), >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
+WaveFrontFlush                 : 0                                 # 0: No CABAC resets are performed, 1: A CABAC reset is performed at the end of each LCU line.
+WaveFrontSubstreams            : 1                                 # >0: This many substreams per slice (or per tile if TileBoundaryIndependenceIdc=1) will be produced.
+
+
+#========== multiview coding tools ==========
+PredDepthMapGen           : 1                                      # generation of prediction depth maps (0:off, 1:using coded motion data, 2:using coded depth maps)
+MultiviewMvPred           : 7                                      # usage of prediction depth maps (0:off, 1:for interview, 2:for inter, 4:for merge, X:bit-wise combinations)
+MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
+MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
+MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+InterViewSkip             : 0                                      # interview SKIP mode
+InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
+
+
+#========== depth coding tools ==========
+DMM                       : 1                                      # use depth intra modes (wedgelets)
+MVI                       : 1                                      # motion parameter inheritance
+VSO                       : 1                                      # use of view synthesis optimization for depth coding
+
+
+#========== texture coding tools based on depth ==========
+VSP                       : 1
+VSPDepthDisable           : 1
+
+
+#========== view synthesis optimization (VSO) ==========
+VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
+
+#============ Misc. ================
+SEIpictureDigest          : 0                                      # Control generation of picture_digest SEI messages
+
+
Index: /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_d_textureOnly.RefOnly.cfg
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_d_textureOnly.RefOnly.cfg	(revision 193)
+++ /branches/HTM-4.0.1-VSP-dev0/CommonTestConditionsCfgs_CE_on_VSP/baseCfg_3view_d_textureOnly.RefOnly.cfg	(revision 193)
@@ -0,0 +1,220 @@
+
+#========== file i/o ==========
+InputFile_0               : org_0.yuv                              # video input file for view 0
+InputFile_1               : org_1.yuv                              # video input file for view 1
+InputFile_2               : org_2.yuv                              # video input file for view 2
+
+DepthInputFile_0          : org_depth_0.yuv                        # depth input file for view 0
+DepthInputFile_1          : org_depth_1.yuv                        # depth input file for view 1
+DepthInputFile_2          : org_depth_2.yuv                        # depth input file for view 2
+
+ReconFile_0               : rec_0.yuv                              # video output file for view 0
+ReconFile_1               : rec_1.yuv                              # video output file for view 1
+ReconFile_2               : rec_2.yuv                              # video output file for view 2
+
+DepthReconFile_0          : rec_depth_0.yuv                        # depth output file for view 0
+DepthReconFile_1          : rec_depth_1.yuv                        # depth output file for view 1
+DepthReconFile_2          : rec_depth_2.yuv                        # depth output file for view 2
+
+BitstreamFile             : stream.bit                             # bitstream file
+
+#========== general coding parameters ==========
+NumberOfViews             : 3                                      # number of views to be coded
+CodeDepthMaps             : 1                                      # encode depth maps
+FrameSkip                 : 0                                      # number of frames to be skipped at beginning of input sequences
+InputBitDepth             : 8                                      # bit depth of input files
+OutputBitDepth            : 8                                      # bit depth of output files
+InternalBitDepth          : 8                                      # internal bit depth used for coding
+
+CroppingMode              : 0                                      # Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping)
+CropLeft                  : 0                                      # Left cropping/padding for cropping mode 3
+CropRight                 : 0                                      # Right cropping/padding for cropping mode 3
+CropTop                   : 0                                      # Top cropping/padding for cropping mode 3
+CropBottom                : 0                                      # Bottom cropping/padding for cropping mode 3
+HorizontalPadding         : 0                                      # horizontal source padding for cropping mode 2
+VerticalPadding           : 0                                      # vertical source padding for cropping mode 2
+
+
+#========== camera parameters ==========
+CameraParameterFile       : cam_pars.txt                           # camera parameter file
+CodedCamParsPrecision     : 5                                      # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
+
+
+#========== coding unit definitions ==========
+MaxCUWidth                : 64                                     # maximum coding unit witdh  (in luma samples) 
+MaxCUHeight               : 64                                     # maximum coding unit height (in luma samples)
+MaxPartitionDepth         : 4                                      # maximum coding unit depth
+QuadtreeTULog2MaxSize     : 5                                      # log2 of maximum transform size
+QuadtreeTULog2MinSize     : 2                                      # log2 of minimum transform size
+QuadtreeTUMaxDepthIntra   : 3                                      # maximum transform tree depth for intra-coded CU's
+QuadtreeTUMaxDepthInter   : 3                                      # maximum transform tree depth for inter-coded CU's
+
+
+#========== coding structure ==========
+IntraPeriod               : 24                                     # Period of I-Frame ( -1 = only first)
+DecodingRefreshType       : 1                                      # Random Accesss 0:none, 1:CDR, 2:IDR
+GOPSize                   : 8                                      # GOP Size (number of B slice = GOPSize-1)
+# V0        Type POC QPoffset QPfactor temporal_id #ref_pics_active ref_pic #ref_pics reference pictures predict deltaRIdx-1 deltaRPS #ref_idcs reference idcs  #IV_ref_pics  IV reference pics  IV ref list pos
+Frame1    : B    8   1        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      0                                                         0
+Frame2    : B    4   2        0.3536   0           2                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       0                                                         0
+Frame3    : B    2   3        0.3536   0           2                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         0                                                         0
+Frame4    : B    1   4        0.68     0           2                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame5    : B    3   4        0.68     0           2                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       0                                                         0
+Frame6    : B    6   3        0.3536   0           2                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       0                                                         0
+Frame7    : B    5   4        0.68     0           2                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       0                                                         0
+Frame8    : B    7   4        0.68     0           2                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       0                                                         0
+FrameI_v1 : P    0   3        0.442    0           1                1       0                            0                                                      1             -1                 1                  0     1              -1            2                 0
+Frame1_v1 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -1                 2                  0     1              -1            3                 3
+Frame2_v1 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -1                 2                  0     1              -1            4                 4
+Frame3_v1 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -1                 2                  0     1              -1            4                 4
+Frame4_v1 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -1                 2                  0     0
+Frame5_v1 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     0
+Frame6_v1 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -1                 3                  0     1              -1            4                 4
+Frame7_v1 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -1                 3                  0     0
+Frame8_v1 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -1                 3                  0     0
+FrameI_v2 : P    0   3        0.442    0           1                1       0                            0                                                      1             -2                 1                  0     1              -2            2                 0
+Frame1_v2 : B    8   4        0.442    0           4                1       4         -8 -10 -12 -16     0                                                      1             -2                 2                  0     1              -2            3                 3
+Frame2_v2 : B    4   5        0.3536   0           3                1       3         -4 -6  4           1       0           4        5         1 1 0 0 1       1             -2                 2                  0     1              -2            4                 4
+Frame3_v2 : B    2   6        0.3536   0           3                1       4         -2 -4  2 6         1       0           2        4         1 1 1 1         1             -2                 2                  0     1              -2            4                 4
+Frame4_v2 : B    1   7        0.68     0           3                0       4         -1  1  3 7         1       0           1        5         1 0 1 1 1       1             -2                 2                  0     0
+Frame5_v2 : B    3   7        0.68     0           3                0       4         -1 -3  1 5         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     0
+Frame6_v2 : B    6   6        0.3536   0           3                1       4         -2 -4 -6 2         1       0          -3        5         1 1 1 1 0       1             -2                 3                  0     1              -2            4                 4
+Frame7_v2 : B    5   7        0.68     0           3                0       4         -1 -5  1 3         1       0           1        5         1 0 1 1 1       1             -2                 3                  0     0
+Frame8_v2 : B    7   7        0.68     0           3                0       4         -1 -3 -7 1         1       0          -2        5         1 1 1 1 0       1             -2                 3                  0     0
+
+ListCombination           : 1                                      # Use combined list for uni-prediction in B-slices
+LCModification            : 0                                      # enables signalling of combined reference list derivation
+DisableInter4x4           : 1                                      # Disable Inter4x4 (1: Disable Inter4x4, 0: Enable Inter4x4)
+
+
+#========== encoder control /motion search ==========
+FastSearch                : 1                                      # motion search mode (0:Full search, 1:Diamond, 2:PMVFAST)
+SearchRange               : 96                                     # motion search range (in luma samples)
+BipredSearchRange         : 4                                      # motion search range for bi-prediction refinement (in luma samples)
+HadamardME                : 1                                      # use Hadamard SAD for fractional-sample search
+FEN                       : 1                                      # use fast encoder control
+FDM                       : 1                                      # Fast Decision for Merge RD cost
+TMVP                      : 1                                      # Enable TMVP
+ECU                       : 0                                      # Early CU setting
+CFM                       : 0                                      # Cbf fast mode setting
+SBACRD                    : 1                                      # SBAC based RD estimation
+ASR                       : 0                                      # adaptive motion search range
+
+
+#========== quantization ==========
+DeltaQpRD                 : 0                                      # maximum delta QP offset for a slice
+MaxDeltaQP                : 0                                      # maximum delta QP offset for a block
+MaxCuDQPDepth             : 0                                      # max depth of a minimum CuDQP for sub-LCU-level delta QP
+RDOQ                      : 1 1                                    # use rate-distortion optimized quantization (RDOQ)
+ChromaQpOffset            : 0                                      # ChromaQPOffset
+ChromaQpOffset2nd         : 0                                      # ChromaQPOffset2nd
+AdaptiveQpSelection       : 0                                      # AdaptiveQpSelection
+AdaptiveQP                : 0                                      # QP adaptation based on a psycho-visual model
+MaxQPAdaptationRange      : 6                                      # QP adaptation range
+LambdaModifier0           : 1.0                                    # Lambda modifier for temporal layer 0
+LambdaModifier1           : 1.0                                    # Lambda modifier for temporal layer 1
+LambdaModifier2           : 1.0                                    # Lambda modifier for temporal layer 2
+LambdaModifier3           : 1.0                                    # Lambda modifier for temporal layer 3
+
+
+#=========== Quantization Matrix =================
+ScalingList               : 0                                      # ScalingList 0 : off, 1 : default, 2 : file read
+# ScalingListFile         :                                        # Scaling List file name. If file is not exist, use Default Matrix.
+
+
+#============ Lossless ================
+LosslessCuEnabled         : 0                                      # 1: Set "qpprime_y_zero_transquant_bypass_flag=1" and enable the lossless mode as well as the RD-based mode selection process.
+
+
+#========== slices ==========
+SliceGranularity          : 0                                      # Slice granularity relative the LCU size
+SliceMode                 : 0                                      # slice mode (0:off, 1:max # of LCUs, 2:max # of bytes)
+SliceArgument             : 1500                                   # slice argument (SliceMode1:max # of LCUs, SliceMode2: max # of bytes)
+EntropySliceMode          : 0                                      # entropy slices (0:off, 1:max # of LCUs, 2:max # of bins)
+EntropySliceArgument      : 180000                                 # entropy slice argument (EntropySliceMode1:max # of LCUs, EntropySliceMode2:max # of bins)
+LFCrossSliceBoundaryFlag  : 1                                      # loop-filtering across slice boundaries
+
+
+#========== deblocking ==========
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
+LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
+LoopFilterDisable              : 0 1                               # disable deblocking filter
+LoopFilterBetaOffset_div2      : 0                                 # Range: -13 ~ 13
+LoopFilterTcOffset_div2        : 0                                 # Range: -13 ~ 13
+
+
+#========== coding tools ==========
+ALFEncodePassReduction         : 0                                 # ALF encoding (0:original 16-pass, 1:one-pass, 2:two-pass)
+SAO                            : 1 0                               # Sample adaptive offset  (0: OFF, 1: ON)
+ALF                            : 0 0                               # Adaptive loop filter  (0: OFF, 1: ON)
+LMChroma                       : 0                                 # Chroma from luma intra prediction mode (0: OFF, 1: ON)
+NSQT                           : 0                                 # Non-square transforms (0: OFF, 1: ON)
+AMP                            : 0                                 # Asymmetric motion partitions (0: OFF, 1: ON)
+ALFMaxNumFilter                : 16                                # ALF Max Number Filters per picture
+ALFParamInSlice                : 0                                 # ALF params in SliceHeader or APS (0=APS, 1=SliceHeader)
+ALFPicBasedEncode              : 1                                 # ALF LCU-based or picture-based encoding (0: LCU-based, 1: Picture-based)  
+MaxNumOffsetsPerPic            : 2048                              # default
+SAOInterleaving                : 0                                 # SAO interleaving flag (0: SAO parameter in APS, 1: SAO parameter in slice data) 
+ConstrainedIntraPred           : 0                                 # Constrained Intra Prediction
+weighted_pred_flag             : 0                                 # weighted prediction flag (P-Slices)
+weighted_bipred_idc            : 0                                 # weighted bipred idc (B-Slices)
+SignHideFlag                   : 1                                 # sign hiding
+SignHideThreshold              : 4                                 # sign hiding threshold
+
+
+#============ PCM ================
+PCMEnabledFlag                 : 0                                 # 0: No PCM mode
+PCMLog2MaxSize                 : 5                                 # Log2 of maximum PCM block size.
+PCMLog2MinSize                 : 3                                 # Log2 of minimum PCM block size.
+PCMInputBitDepthFlag           : 1                                 # 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
+PCMFilterDisableFlag           : 0                                 # 0: Enable loop filtering on I_PCM samples. 1: Disable loop filtering on I_PCM samples.
+
+
+#============ Tiles ================
+TileInfoPresentFlag            : 1                                 # 0: tiles parameters are NOT present in the PPS, 1: tiles parameters are present in the PPS 
+UniformSpacingIdc              : 0                                 # 0: the column boundaries are indicated by ColumnWidth array, the row boundaries are indicated by RowHeight array, 1: the column and row boundaries are distributed uniformly
+NumTileColumnsMinus1           : 0                                 # Number of columns in a picture minus 1
+ColumnWidthArray               : 2 3                               # Array containing ColumnWidth values in units of LCU (from left to right in picture)   
+NumTileRowsMinus1              : 0                                 # Number of rows in a picture minus 1
+RowHeightArray                 : 2                                 #  Array containing RowHeight values in units of LCU (from top to bottom in picture)
+TileLocationInSliceHeaderFlag  : 0                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile location information to slice header, 0: Disable writing tile location information to slice header.
+TileMarkerFlag                 : 1                                 # If TileBoundaryIndependenceIdc==0 flag is ignored, 1: Enable writing tile markers, 0: Disable writing tile markers.
+MaxTileMarkerEntryPoints       : 4                                 # Maximum number of uniformly-spaced tile entry points (using tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.
+TileControlPresentFlag         : 1                                 # 0: tiles behavior control parameters are NOT present in the PPS,  1: tiles behavior control parameters are present in the PPS
+LFCrossTileBoundaryFlag        : 1                                 # In-loop filtering is across or not across tile boundary.  0:not across, 1: across                                                       
+
+
+#============ WaveFront ================
+WaveFrontSynchro               : 0                                 # 0:  No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case), >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
+WaveFrontFlush                 : 0                                 # 0: No CABAC resets are performed, 1: A CABAC reset is performed at the end of each LCU line.
+WaveFrontSubstreams            : 1                                 # >0: This many substreams per slice (or per tile if TileBoundaryIndependenceIdc=1) will be produced.
+
+
+#========== multiview coding tools ==========
+PredDepthMapGen           : 1                                      # generation of prediction depth maps (0:off, 1:using coded motion data, 2:using coded depth maps)
+MultiviewMvPred           : 7                                      # usage of prediction depth maps (0:off, 1:for interview, 2:for inter, 4:for merge, X:bit-wise combinations)
+MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
+MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
+MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+InterViewSkip             : 0                                      # interview SKIP mode
+InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
+
+
+#========== depth coding tools ==========
+DMM                       : 1                                      # use depth intra modes (wedgelets)
+MVI                       : 1                                      # motion parameter inheritance
+VSO                       : 1                                      # use of view synthesis optimization for depth coding
+
+
+#========== texture coding tools based on depth ==========
+VSP                       : 1
+VSPDepthDisable           : 1
+
+
+#========== view synthesis optimization (VSO) ==========
+VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
+
+#============ Misc. ================
+SEIpictureDigest          : 0                                      # Control generation of picture_digest SEI messages
+
+
Index: /branches/HTM-4.0.1-VSP-dev0/build/vc9/TLibCommon_vc9.vcproj
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/build/vc9/TLibCommon_vc9.vcproj	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/build/vc9/TLibCommon_vc9.vcproj	(revision 193)
@@ -292,8 +292,4 @@
 			</File>
 			<File
-				RelativePath="..\..\source\Lib\TLibCommon\DebugLog.cpp"
-				>
-			</File>
-			<File
 				RelativePath="..\..\source\Lib\libmd5\libmd5.c"
 				>
@@ -422,8 +418,4 @@
 			</File>
 			<File
-				RelativePath="..\..\source\Lib\TLibCommon\DebugLog.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\source\Lib\libmd5\libmd5.h"
 				>
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecCfg.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 193)
@@ -103,5 +103,5 @@
   if (!m_pchBitstreamFile)
   {
-    fprintf(stderr, "No input file specifed, aborting\n");
+    fprintf(stderr, "No input file specified, aborting\n");
     return false;
   }
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp	(revision 193)
@@ -262,15 +262,4 @@
     }
   }
-#if DEBUGIMGOUT
-  for(Int viewDepthIdx=0; viewDepthIdx<m_tVideoIOYuvReconDbgFile.size() ; viewDepthIdx++)
-  {
-    if( m_tVideoIOYuvReconDbgFile[viewDepthIdx] )
-    {
-      m_tVideoIOYuvReconDbgFile[viewDepthIdx]->close();
-      delete m_tVideoIOYuvReconDbgFile[viewDepthIdx]; 
-      m_tVideoIOYuvReconDbgFile[viewDepthIdx] = NULL ;
-    }
-  }
-#endif
 
   for(Int viewDepthIdx=0; viewDepthIdx<m_tDecTop.size() ; viewDepthIdx++)
@@ -341,11 +330,4 @@
 #endif
       }
-#if DEBUGIMGOUT
-#if PIC_CROPPING
-      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
-#else
-      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), pcPic->getSlice(0)->getSPS()->getPad() );
-#endif
-#endif   
       
       // update POC of display order
@@ -406,11 +388,4 @@
 #endif
       }
-#if DEBUGIMGOUT
-#if PIC_CROPPING
-      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
-#else
-      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), pcPic->getSlice(0)->getSPS()->getPad() );
-#endif
-#endif
       
       // update POC of display order
@@ -501,29 +476,5 @@
   }
 #endif
-#if DEBUGIMGOUT
-  while( m_tVideoIOYuvReconDbgFile.size() < newNumberOfViewDepth)
-  {
-    m_tVideoIOYuvReconDbgFile.push_back(new TVideoIOYuv);
-    Char buffer[4];
-    sprintf(buffer,"_%i", (Int)(m_tVideoIOYuvReconDbgFile.size()-1) / 2 );
-    Char* nextFilename = NULL;
-    if( (m_tVideoIOYuvReconDbgFile.size() % 2) == 0 )
-    {
-      Char* pchTempFilename = NULL;
-      xAppendToFileNameEnd( "DebugImg.yuv", "_depth", pchTempFilename);
-      xAppendToFileNameEnd( pchTempFilename, buffer, nextFilename);
-      free ( pchTempFilename );
-    }
-    else
-    {
-      xAppendToFileNameEnd( "DebugImg.yuv", buffer, nextFilename);
-    }
-    if( isDepth || ( !isDepth && (m_tVideoIOYuvReconDbgFile.size() % 2) == 1 ) )
-    {
-      m_tVideoIOYuvReconDbgFile.back()->open( nextFilename, true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement );
-    }
-    free ( nextFilename );
-  }
-#endif
+
   while( m_pocLastDisplay.size() < newNumberOfViewDepth )
   {
@@ -587,11 +538,8 @@
 {
   //first view does not have VSP 
-#if VSP_TEXT_ONLY
-  if((iCodedViewIdx == 0)||(bDepth))
-#else
   if((iCodedViewIdx == 0))
-#endif
     return;
   pcPicVSP->getSlice(0)->setPOC( iCurPoc );
+  pcPicVSP->getSlice(0)->setViewId( iCodedViewIdx );
   Int iNeighborViewId = 0;
   Bool bRenderFromLeft;
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h	(revision 193)
@@ -68,7 +68,4 @@
 
   std::vector<TVideoIOYuv*>       m_tVideoIOYuvReconFile;         ///< reconstruction YUV class
-#if DEBUGIMGOUT
-  std::vector<TVideoIOYuv*>       m_tVideoIOYuvReconDbgFile;      ///< debug YUV class
-#endif
 
   // for output control
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 193)
@@ -120,4 +120,25 @@
 #endif
 
+#if FIX_MEM_LEAKS
+ if ( m_pchCameraParameterFile != NULL )
+   free ( m_pchCameraParameterFile ); 
+
+ if ( m_pchBaseViewCameraNumbers != NULL )
+   free ( m_pchBaseViewCameraNumbers ); 
+
+ if ( m_pchdQPFile      != NULL ) 
+   free ( m_pchdQPFile      );
+
+ if ( m_pchColumnWidth  != NULL ) 
+   free ( m_pchColumnWidth  );
+
+ if ( m_pchRowHeight    != NULL ) 
+   free ( m_pchRowHeight    );
+
+ if ( m_scalingListFile != NULL ) 
+   free ( m_scalingListFile );
+
+#endif   
+
 }
 
@@ -168,4 +189,20 @@
     in>>entry.m_interViewRefPosL1[i];
   }
+#if VSP_CFG
+  in>>entry.m_numVSPRefPics;
+  for( Int i = 0; i < entry.m_numVSPRefPics; i++ )
+  {
+    in>>entry.m_VSPRefPics[i];
+  }
+  for( Int i = 0; i < entry.m_numVSPRefPics; i++ )
+  {
+    in>>entry.m_VSPRefPosL0[i];
+  }
+  for( Int i = 0; i < entry.m_numVSPRefPics; i++ )
+  {
+    in>>entry.m_VSPRefPosL1[i];
+  }
+#endif
+
   return in;
 }
@@ -339,5 +376,19 @@
   ("AllowNegDist",                    m_bAllowNegDist           , true          , "Allow negative Distortion in VSO")
 #endif
-
+#if LGE_WVSO_A0119
+  ("WVSO",                            m_bUseWVSO                , false         , "Use depth fidelity term for VSO" )
+  ("VSOWeight",                       m_iVSOWeight              , 10            , "Synthesized View Distortion Change weight" )
+  ("VSDWeight",                       m_iVSDWeight              , 1             , "View Synthesis Distortion estimate weight" )
+  ("DWeight",                         m_iDWeight                , 1             , "Depth Distortion weight" )
+#endif
+
+#if OL_DEPTHLIMIT_A0044
+  ("DPL",                             m_bDepthPartitionLimiting , false         , "Use DepthPartitionLimiting" )
+#endif
+#endif
+
+#if VSP_N
+  ("VSP",                             m_bUseVSP                 , false         , "Use VSP" )    
+  ("VSPDepthDisable",                 m_bVSPDepthDisable        , false         , "Use VSP Depth Disable" )    
 #endif
 
@@ -498,5 +549,5 @@
   m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str());
   m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
-
+  
   if ( m_bUsingDepthMaps )
   {
@@ -648,4 +699,7 @@
 #endif
 
+#if LGE_WVSO_A0119
+  m_bUseWVSO = m_bUseVSO && m_bUseWVSO && m_bUsingDepthMaps;
+#endif
   xCleanUpVectors();
 
@@ -1107,4 +1161,49 @@
   }
   xConfirmPara( bErrorIvpEnhV, "Invalid inter-view coding structure for enhancement views given" );
+
+#if VSP_CFG
+  // validate vsp refs
+  Bool bErrorVspEnhV = false;
+  if( m_iNumberOfViews > 1 )
+  {
+    for( Int k = 1; k < m_iNumberOfViews; k++ )
+    {
+      for( Int i = 0; i < MAX_GOP+1; i++ )
+      {
+        if( m_GOPListsMvc[k][i].m_numVSPRefPics < 0 || m_GOPListsMvc[k][i].m_numVSPRefPics > 1 )
+        {
+          printf( "\nError: m_numVSPRefPics < 0 or m_numVSPRefPics > 1 \n" );
+          bErrorVspEnhV = true;
+        }
+
+        for( Int j = 0; j < m_GOPListsMvc[k][i].m_numVSPRefPics; j++ )
+        {
+          Int iAbsViewId = m_GOPListsMvc[k][i].m_VSPRefPics[j] + k;
+          if( iAbsViewId != 0 )
+          {
+            printf( "\nError: VSP is allowed to reference only base view\n" );
+            bErrorVspEnhV = true;
+          }
+          if( m_GOPListsMvc[k][i].m_sliceType == 'P' && m_GOPListsMvc[k][i].m_VSPRefPosL1[j] != 0 )
+          {
+            printf( "\nError: m_sliceType == P and m_VSPRefPosL1 != 0\n" );
+            bErrorVspEnhV = true;
+          }
+        }
+
+        for( Int j = 0; j < m_GOPListsMvc[k][i].m_numVSPRefPics || j < m_GOPListsMvc[k][i].m_numInterViewRefPics; j++ )
+        {
+          if( (m_GOPListsMvc[k][i].m_VSPRefPosL0[j] != 0 && m_GOPListsMvc[k][i].m_VSPRefPosL0[j] == m_GOPListsMvc[k][i].m_interViewRefPosL0[j]) 
+           || (m_GOPListsMvc[k][i].m_VSPRefPosL1[j] != 0 && m_GOPListsMvc[k][i].m_VSPRefPosL1[j] == m_GOPListsMvc[k][i].m_interViewRefPosL1[j]) )
+          {
+            printf( "\nError: vsp_ref_list_pos[%d] == IV ref list pos[%d]\n", j, j );
+            bErrorVspEnhV = true;
+          }
+        }
+      }
+    }
+  }
+  xConfirmPara( bErrorVspEnhV, "Invalid VSP coding structure for enhancement views given" );
+#endif
 
   // validate temporal coding structure
@@ -1692,5 +1791,11 @@
 #if HHI_VSO
   printf("VSO:%d ", m_bUseVSO             );
-#endif  
+#endif
+#if LGE_WVSO_A0119
+  printf("WVSO:%d ", m_bUseWVSO );
+#endif
+#if OL_DEPTHLIMIT_A0044
+  printf("DPL:%d ", m_bDepthPartitionLimiting);
+#endif
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   printf("DMM:%d ", m_bUseDMM );
@@ -1698,4 +1803,7 @@
 #if HHI_MPI
   printf("MVI:%d ", m_bUseMVI ? 1 : 0 );
+#endif
+#if LGE_WVSO_A0119
+  printf("\nVSO : VSD : SAD weight = %d : %d : %d ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
 #endif
   printf("\n\n");
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.h	(revision 193)
@@ -297,8 +297,22 @@
   Bool      m_bUseEstimatedVSD;                           ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3)  
 #endif
+#if LGE_WVSO_A0119
+  Bool      m_bUseWVSO;                                    ///< flag for using View Synthesis Optimization  
+  Int       m_iVSOWeight;
+  Int       m_iVSDWeight;
+  Int       m_iDWeight;
+#endif
+#if VSP_N
+  Bool      m_bUseVSP;
+  Bool      m_bVSPDepthDisable;
+#endif
 
   // coding tools (depth intra modes)
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   Bool      m_bUseDMM;                                        ///< flag for using DMM
+#endif
+
+#if OL_DEPTHLIMIT_A0044
+  Bool      m_bDepthPartitionLimiting;
 #endif
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 193)
@@ -207,4 +207,7 @@
     m_acTEncTopList[iViewIdx]->setUseEstimatedVSD              ( false );
 #endif
+#if LGE_WVSO_A0119
+    m_acTEncTopList[iViewIdx]->setUseWVSO                      ( false ); 
+#endif
 #endif
 
@@ -361,6 +364,14 @@
     m_acTEncTopList[iViewIdx]->setUseDMM                     ( false );
 #endif
+#if OL_DEPTHLIMIT_A0044
+    m_acTEncTopList[iViewIdx]->setUseDPL                     ( false );
+#endif
 #if HHI_MPI
     m_acTEncTopList[iViewIdx]->setUseMVI( false );
+#endif
+
+#if VSP_N
+    m_acTEncTopList[iViewIdx]->setUseVSP( m_bUseVSP );
+    m_acTEncTopList[iViewIdx]->setVSPDepthDisable( m_bVSPDepthDisable );
 #endif
   }
@@ -524,4 +535,7 @@
       m_acTEncDepthTopList[iViewIdx]->setUseEstimatedVSD              ( m_bUseEstimatedVSD );
 #endif
+#if LGE_WVSO_A0119
+      m_acTEncDepthTopList[iViewIdx]->setUseWVSO                      ( m_bUseWVSO         );
+#endif
 #endif
 
@@ -634,6 +648,14 @@
     m_acTEncDepthTopList[iViewIdx]->setUseDMM                     ( m_bUseDMM );
 #endif
+#if OL_DEPTHLIMIT_A0044
+    m_acTEncDepthTopList[iViewIdx]->setUseDPL                      (m_bDepthPartitionLimiting);
+#endif
 #if HHI_MPI
      m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
+#endif
+
+#if VSP_N
+      m_acTEncDepthTopList[iViewIdx]->setUseVSP( m_bUseVSP );
+      m_acTEncDepthTopList[iViewIdx]->setVSPDepthDisable( m_bVSPDepthDisable );
 #endif
     }
@@ -690,4 +712,17 @@
       AOT(true);
     }
+#if LGE_WVSO_A0119 
+    for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ )
+    {
+      for (Int iContent = 0; iContent < 2; iContent++ )
+      {
+        TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; 
+        pcEncTop->setUseWVSO  ( m_bUseWVSO );
+        pcEncTop->setVSOWeight( m_iVSOWeight );
+        pcEncTop->setVSDWeight( m_iVSDWeight );
+        pcEncTop->setDWeight  ( m_iDWeight );
+      }
+    }
+#endif
   }
 #endif
@@ -938,7 +973,7 @@
         iNumEncoded = 0;
 
-#if VSP_SLICE_HEADER
-        m_acTEncTopList     [iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
-        m_acTEncDepthTopList[iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
+#if VSP_SLICE_HEADER && !VSP_CFG
+        if( m_acTEncTopList     [iViewIdx]->getUseVSP() ) m_acTEncTopList     [iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
+        if( m_acTEncDepthTopList[iViewIdx]->getUseVSP() ) m_acTEncDepthTopList[iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
 #endif
 
@@ -963,4 +998,5 @@
 #if VSP_SLICE_HEADER
           if( m_acTEncDepthTopList[iViewIdx]->getUseVSP() )
+          if( !m_acTEncDepthTopList[iViewIdx]->getVSPDepthDisable() )
 #endif
             xStoreVSPInBuffer(m_acTEncDepthTopList[iViewIdx]->getVSPBuf(), m_acTEncDepthTopList[iViewIdx]->getVSPAvailBuf(), iViewIdx, true, gopId);
@@ -1003,4 +1039,14 @@
   delete pcDepthPicYuvOrg;
   pcDepthPicYuvOrg = NULL;
+  
+#if FIX_MEM_LEAKS
+  if ( pcPdmDepthOrg != NULL )
+  {
+    pcPdmDepthOrg->destroy();
+    delete pcPdmDepthOrg;     
+    pcPdmDepthOrg = NULL; 
+  };
+#endif
+
   
   for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
@@ -1263,5 +1309,9 @@
 Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset )
 {
+#if FIX_VSO_SETUP
+  m_cRendererModel.setupPart( iHorOffset, Min( g_uiMaxCUHeight, m_iSourceHeight - iHorOffset ) ); 
+#else
   m_cRendererModel.setHorOffset( iHorOffset ); 
+#endif
 #else
 Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent )
@@ -1410,9 +1460,5 @@
 {
   //first view does not have VSP 
-#if VSP_TEXT_ONLY
-  if((iCodedViewIdx == 0)||(bDepth))
-#else
   if((iCodedViewIdx == 0))
-#endif
     return;
 
@@ -1439,6 +1485,7 @@
   }
   pcPicVSP->getSlice(0)->setPOC( iCurPoc );
-
-  Int iNeighborViewId = 0;
+  pcPicVSP->getSlice(0)->setViewId( iCodedViewIdx );
+
+  Int iNeighborViewId = 0;  //iCodedViewIdx + m_GOPListsMvc[iCodedViewIdx][gopId].m_VSPRefPics[0];
   Bool bRenderFromLeft;
   //check if the neighboring view is situated to the left of the current view
Index: /branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.cpp	(revision 193)
@@ -533,5 +533,9 @@
 
 #if HHI_VSO_SPEEDUP_A0033
+#if FIX_VSO_SETUP
+    cCurModel.setupPart( 0, m_iSourceHeight  ); 
+#else
     cCurModel.setHorOffset( 0 );
+#endif
 #endif
 
@@ -710,5 +714,9 @@
   AOT( m_iLog2SamplingFactor != 0 );
 #if HHI_VSO_SPEEDUP_A0033
+#if FIX_VSO_SETUP
+  cCurModel.setupPart( 0, m_iSourceHeight  ); 
+#else
   cCurModel.setHorOffset( 0 );
+#endif
 #endif
 #if LGE_VSO_EARLY_SKIP_A0093
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/CommonDef.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/CommonDef.h	(revision 193)
@@ -58,5 +58,5 @@
 
 #define HM_VERSION        "6.1"
-#define NV_VERSION        "4.0.1"                 ///< Current software version
+#define NV_VERSION        "4.1"                  ///< Current software version
 
 // ====================================================================================================================
Index: anches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/DebugLog.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/DebugLog.cpp	(revision 192)
+++ 	(revision )
@@ -1,565 +1,0 @@
-#include "CommonDef.h"
-#include "TComYuv.h"
-#include "TComPic.h"
-#include "../TLibDecoder/TDecCu.h"
-#include "DebugLog.h"
-
-
-char* pcPartSizeName[] =
-{
-  "SIZE_2Nx2N",           ///< symmetric motion partition,  2Nx2N
-  "SIZE_2NxN",            ///< symmetric motion partition,  2Nx N
-  "SIZE_Nx2N",            ///< symmetric motion partition,   Nx2N
-  "SIZE_NxN",             ///< symmetric motion partition,   Nx N
-
-  "SIZE_2NxnU",           ///< asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2)
-  "SIZE_2NxnD",           ///< asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2)
-  "SIZE_nLx2N",           ///< asymmetric motion partition, ( N/2)x2N + (3N/2)x2N
-  "SIZE_nRx2N"            ///< asymmetric motion partition, (3N/2)x2N + ( N/2)x2N
-};
-
-char* pcPredModeName[] = 
-{
-  "MODE_SKIP",            ///< SKIP mode
-  "MODE_INTER",           ///< inter-prediction mode
-  "MODE_INTRA"            ///< intra-prediction mode
-#if FORCE_REF_VSP==1
-  ,"MODE_SYNTH"           ///< vsp skip mode
-#endif
-};
-
-void printMotionInfo( TComDataCU* pcCU, UInt uiIdx, FILE* pfFile )
-{
-  UInt iInterDir = pcCU->getInterDir( uiIdx );
-  fprintf(pfFile, "interDir,%d, ", iInterDir );
-  if (iInterDir != 2) {
-    fprintf(pfFile, "L0Idx,%d, ", pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiIdx ));
-    fprintf(pfFile, "L0Mv(,%d,%d,), ", pcCU->getCUMvField(REF_PIC_LIST_0)->getMv( uiIdx ).getHor(), pcCU->getCUMvField(REF_PIC_LIST_0)->getMv( uiIdx ).getVer() );
-  } else {
-    fprintf(pfFile, "L0Idx,-, L0Mv(,-,-,), ");
-  }
-  if (iInterDir != 1) {
-    fprintf(pfFile, "L1Idx,%d, ", pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiIdx ));
-    fprintf(pfFile, "L1Mv(,%d,%d,), ", pcCU->getCUMvField(REF_PIC_LIST_1)->getMv( uiIdx ).getHor(), pcCU->getCUMvField(REF_PIC_LIST_1)->getMv( uiIdx ).getVer() );
-  } else {
-    fprintf(pfFile, "L1Idx,-, L1Mv(,-,-,), ");
-  }
-}
-
-bool DebugLog::DebugLogOut( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  if ( !m_pfDebugLogFile ) return false;
-
-  int iIdxWidth = (pcCU->getWidth( uiAbsPartIdx ) << uiDepth) >> 2;
-  int iXoffset  = (g_auiZscanToRaster[uiAbsPartIdx] % iIdxWidth) << 2;
-  int iYoffset  = (g_auiZscanToRaster[uiAbsPartIdx] / iIdxWidth) << 2;
-  fprintf(m_pfDebugLogFile, "Pos(,%d,%d,) , PartIdx,%d, ", pcCU->getCUPelX()+iXoffset, pcCU->getCUPelY()+iYoffset, uiAbsPartIdx);
-#if (VSP_N)
-  {
-    char cRefVsp = 0; Int aiRefIdx[2] = {-1, -1};
-    Int iRefIdx = pcCU->getCUMvField( RefPicList(0) )->getRefIdx( uiAbsPartIdx ); aiRefIdx[0] = iRefIdx;
-    if( iRefIdx >= 0 ) cRefVsp |= (pcCU->getSlice()->getRefViewId( RefPicList(0), iRefIdx ) == NUM_VIEW_VSP ? 0x01 : 0);
-    iRefIdx = pcCU->getCUMvField( RefPicList(1) )->getRefIdx( uiAbsPartIdx ); aiRefIdx[1] = iRefIdx;
-    if( iRefIdx >= 0 ) cRefVsp |= (pcCU->getSlice()->getRefViewId( RefPicList(1), iRefIdx ) == NUM_VIEW_VSP ? 0x02 : 0);
-    fprintf(m_pfDebugLogFile, "VSP,%d, RefIdx(,%d,%d,), ", cRefVsp, aiRefIdx[0], aiRefIdx[1] ); // 0:not VSP, 1:VSP L0, 2:VSP L1, 3:VSP Bi
-    fprintf(m_pfDebugLogFile, "MV(");
-    if(aiRefIdx[0]>=0)fprintf(m_pfDebugLogFile, "(,%d,%d,)",pcCU->getCUMvField( RefPicList(0) )->getMv(uiAbsPartIdx).getHor(),pcCU->getCUMvField( RefPicList(0) )->getMv(uiAbsPartIdx).getVer());
-    else              fprintf(m_pfDebugLogFile, "(,-,-,)");
-    if(aiRefIdx[1]>=0)fprintf(m_pfDebugLogFile, "(,%d,%d,)",pcCU->getCUMvField( RefPicList(1) )->getMv(uiAbsPartIdx).getHor(),pcCU->getCUMvField( RefPicList(1) )->getMv(uiAbsPartIdx).getVer());
-    else              fprintf(m_pfDebugLogFile, "(,-,-,)");
-    fprintf(m_pfDebugLogFile, ")");
-  }
-#endif
-    fprintf(m_pfDebugLogFile, "depth,%d,(,%d x %d,), ", uiDepth, pcCU->getWidth( uiAbsPartIdx ), pcCU->getHeight( uiAbsPartIdx ));
-    fprintf(m_pfDebugLogFile, "Predmode,%s, ", 
-#if FORCE_REF_VSP==1
-    pcCU->getPredictionMode( uiAbsPartIdx ) < 4 ? 
-#else
-    pcCU->getPredictionMode( uiAbsPartIdx ) < 3 ? 
-#endif
-    pcPredModeName[(int)pcCU->getPredictionMode( uiAbsPartIdx )] : "SIZE_NONE");
-#if FORCE_REF_VSP==1
-    fprintf(m_pfDebugLogFile, "VspSkipFlg,%d,", pcCU->getPredictionMode( uiAbsPartIdx )==MODE_SYNTH?1:0);
-#endif
-#if HHI_MPI
-    fprintf(m_pfDebugLogFile, "TextModeDepFlg,%d,", pcCU->getSlice()->getIsDepth() ? (pcCU->getTextureModeDepth( uiAbsPartIdx )==uiDepth) : 0 );
-#endif
-    fprintf(m_pfDebugLogFile, "Mergeflag,%d,MergeIdx,%d,", pcCU->getMergeFlag( uiAbsPartIdx ), pcCU->getMergeIndex( uiAbsPartIdx ) );
-    fprintf(m_pfDebugLogFile, "Partsize,%s, ", pcCU->getPartitionSize( uiAbsPartIdx ) < 8 ? pcPartSizeName[(int)pcCU->getPartitionSize( uiAbsPartIdx )] : "SIZE_NONE");
-    fprintf(m_pfDebugLogFile, "Cbf(,%d,%d,%d,), ", pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA), pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U), pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) );
-
-#if OUT_PRED_INFO
-  UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(uiAbsPartIdx) << 1 ) ) >> 2;
-  if (pcCU->getPredictionMode( uiAbsPartIdx ) != MODE_INTRA) {
-    //InterDirectionNum,L0Idx,L0Mv,L1Idx,L1Mv
-    printMotionInfo( pcCU, uiAbsPartIdx, m_pfDebugLogFile );
-    switch ( pcCU->getPartitionSize( uiAbsPartIdx ) )
-    {
-      case SIZE_2Nx2N:{ break; }
-      case SIZE_2NxN: { printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset << 1), m_pfDebugLogFile );    break; }
-      case SIZE_Nx2N: { printMotionInfo( pcCU, uiAbsPartIdx +  uiPartOffset      , m_pfDebugLogFile );    break; }
-      case SIZE_NxN:  
-      {
-        for ( Int iPartIdx = 0; iPartIdx < 4; iPartIdx++ ) {
-          printMotionInfo( pcCU, uiAbsPartIdx + uiPartOffset * iPartIdx, m_pfDebugLogFile );
-        }
-        break;
-      }
-#if ASYMMETRIC_USE
-      case SIZE_2NxnU:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset >> 1)                      , m_pfDebugLogFile );    break; }
-      case SIZE_2NxnD:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset << 1) + (uiPartOffset >> 1), m_pfDebugLogFile ); break; }
-      case SIZE_nLx2N:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset >> 2)                      , m_pfDebugLogFile );    break; }
-      case SIZE_nRx2N:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset     ) + (uiPartOffset >> 2), m_pfDebugLogFile ); break; }
-#endif
-      default:        { break; }
-    }
-  } else {
-    //IntraPredDirection
-    fprintf( m_pfDebugLogFile, "IntraDir(L,%d,C,%d,), ", pcCU->getLumaIntraDir( uiAbsPartIdx ), pcCU->getChromaIntraDir( uiAbsPartIdx ) );
-    if (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN)
-    {
-      for (int i=1; i < 4; i++) {
-        fprintf( m_pfDebugLogFile, "IntraDir(L,%d,C,%d,), ", pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset * i ), pcCU->getChromaIntraDir( uiAbsPartIdx + uiPartOffset * i ) );
-      }
-    }
-  }
-#endif
-  fprintf(m_pfDebugLogFile, "\n");
-  return true;
-}
-
-
-//Color set function of TComYuv 
-#if DEBUGIMGOUT
-Void TComYuv::colsetToPicYuv   ( const UChar ucColor[3], Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx, Bool bDrawLine )
-{
-  colsetToPicLuma  ( ucColor[0],             iOffset, pcPicYuvDst, iCuAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx, bDrawLine );
-  for (int i=0; i < 2; i++)
-    for (int j=0; j < 2; j++)
-      iOffset[i][j] >>= 1;
-  colsetToPicChroma( ucColor[1], ucColor[2], iOffset, pcPicYuvDst, iCuAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx, bDrawLine );
-}
-
-Void TComYuv::colsetToPicLuma  ( const UChar ucLumaOffCol, Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx, Bool bDrawLine )
-{
-  Int  offset  = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0;
-  Int  iStartX = bDrawLine ? 1:0;
-  Int  y, x, iWidth, iHeight;
-  iWidth  = m_iWidth >>uiPartDepth;
-  iHeight = m_iHeight>>uiPartDepth;
-
-  Pel* pSrc     = getLumaAddr(uiPartIdx, iWidth);
-  Pel* pDst     = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
-
-  UInt  iSrcStride  = getStride();
-  UInt  iDstStride  = pcPicYuvDst->getStride();
-
-  pSrc += iOffset[0][1] * iSrcStride + iOffset[0][0]; //TopLeft
-  pDst += iOffset[0][1] * iDstStride + iOffset[0][0]; //TopLeft
-  iWidth  = iOffset[1][0];  //ButtomRight
-  iHeight = iOffset[1][1];  //ButtomRight
-
-
-  if( bDrawLine )
-  {
-    for( x = 0; x < iWidth; x++ )
-      pDst[x] = (((pSrc[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2;  //Top line
-    pDst += iDstStride;
-    pSrc += iSrcStride;
-    iHeight--;
-  }
-
-  if( ucLumaOffCol == 0 )
-  {
-    for ( y = iHeight; y != 0; y-- )
-    {
-      if( bDrawLine )
-        pDst[0] =  (((pSrc[0] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2;  //Left line
-      for( x = iStartX; x < iWidth; x++ )
-        pDst[x] = (pSrc[x] + offset) >> g_uiBitIncrement;  //glay scale
-      pDst += iDstStride;
-      pSrc += iSrcStride;
-    }
-  } else {
-    for ( y = iHeight; y != 0; y-- )
-    {
-      if( bDrawLine )
-        pDst[0] =  (((pSrc[0] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2;  //Left line
-      for( x = iStartX; x < iWidth; x++ )
-        pDst[x] = (((pSrc[x] + offset) >> g_uiBitIncrement) >> 2) + ucLumaOffCol;
-      pDst += iDstStride;
-      pSrc += iSrcStride;
-    }
-  }
-}
-
-Void TComYuv::colsetToPicChroma( const UChar ucUCol, const UChar ucVCol, Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx, Bool bDrawLine )
-{
-  Int  y, x, iWidth, iHeight;
-  iWidth  = m_iCWidth >>uiPartDepth;
-  iHeight = m_iCHeight>>uiPartDepth;
-  Int  iStartX = bDrawLine ? 1:0;
-
-  Pel* pDstU      = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx );
-  Pel* pDstV      = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx );
-
-  UInt  iDstStride = pcPicYuvDst->getCStride();
-
-  pDstU += iOffset[0][1] * iDstStride + iOffset[0][0]; //TopLeft
-  pDstV += iOffset[0][1] * iDstStride + iOffset[0][0]; //TopLeft
-  iWidth  = iOffset[1][0];  //ButtomRight
-  iHeight = iOffset[1][1];  //ButtomRight
-
-  if( bDrawLine )
-  {
-    for( x = 0; x < iWidth; x++ )
-    {
-      pDstU[x] = LINE_CB_COL2;  //Top line color
-      pDstV[x] = LINE_CR_COL2;  //Top line color
-    }
-    pDstV += iDstStride;
-    pDstU += iDstStride;
-    iHeight--;
-  }
-  for ( y = iHeight; y != 0; y-- )
-  {
-    if( bDrawLine ) {
-      pDstU[0] =  LINE_CB_COL2;  //Left line color
-      pDstV[0] =  LINE_CR_COL2;  //Left line color
-    }
-    for( x = iStartX; x < iWidth; x++ )
-    {
-      pDstU[x] = ucUCol;
-      pDstV[x] = ucVCol;
-    }
-    pDstU += iDstStride;
-    pDstV += iDstStride;
-  }
-}
-
-Void TComYuv::drawLineToPicYuv ( bool bHor, bool bVer, UInt uiSize, TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx )
-{
-  Int  offset  = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0;
-  Int  y, x, iWidth, iHeight, iWidthC, iHeightC;
-
-  iWidth   = m_iWidth >>uiPartDepth;
-  iHeight  = m_iHeight>>uiPartDepth;
-  iWidthC  = m_iCWidth >>uiPartDepth;
-  iHeightC = m_iCHeight>>uiPartDepth;
-
-
-  Pel* pSrc     = getLumaAddr(uiPartIdx, iWidth);
-  Pel* pDst     = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
-  Pel* pDstU    = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx );
-  Pel* pDstV    = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx );
-
-  UInt  iSrcStride  = getStride();
-  UInt  iDstStride  = pcPicYuvDst->getStride();
-  UInt  iDstStrideC = pcPicYuvDst->getCStride();
-
-  if ( bHor )
-  {
-    //Luma
-    Pel* pDstHor = pDst + iDstStride * ((iHeight * uiSize) >> 2);
-    Pel* pSrcHor = pSrc + iSrcStride * ((iHeight * uiSize) >> 2);
-    for( x = 1; x < iWidth; x++ )
-      pDstHor[x] = (((pSrcHor[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL;
-    //CbCr
-    Pel* pDstUHor = pDstU + iDstStrideC * ((iHeightC * uiSize) >> 2);
-    Pel* pDstVHor = pDstV + iDstStrideC * ((iHeightC * uiSize) >> 2);
-    for( x = 1; x < iWidthC; x++ )
-    {
-      pDstUHor[x] = LINE_CB_COL;
-      pDstVHor[x] = LINE_CR_COL;
-    }
-  }
-  if ( bVer )
-  {
-    //Luma
-    Pel* pDstVer = pDst + iDstStride;
-    Pel* pSrcVer = pSrc + iSrcStride;
-    x = (iWidth * uiSize) >> 2;
-    for ( y = iHeight; y != 1; y-- )
-    {
-      pDstVer[x] = (((pSrcVer[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL;
-      pDstVer += iDstStride;
-      pSrcVer += iSrcStride;
-    }
-    //CbCr
-    Pel* pDstVerU = pDstU + iDstStrideC;
-    Pel* pDstVerV = pDstV + iDstStrideC;
-    x = (iHeightC * uiSize) >> 2;
-    for ( y = iHeightC; y != 1; y-- )
-    {
-      pDstVerU[x] = LINE_CB_COL;
-      pDstVerV[x] = LINE_CR_COL;
-      pDstVerU += iDstStrideC;
-      pDstVerV += iDstStrideC;
-    }
-  }
-  
-}
-
-Void TComYuv::drawRectToPicYuv ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx )
-{
-  Int  offset  = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0;
-  Int  y, x, iWidth, iHeight, iWidthC, iHeightC;
-
-  iWidth   = m_iWidth >>uiPartDepth;
-  iHeight  = m_iHeight>>uiPartDepth;
-  iWidthC  = m_iCWidth >>uiPartDepth;
-  iHeightC = m_iCHeight>>uiPartDepth;
-
-
-  Pel* pSrc     = getLumaAddr(uiPartIdx, iWidth);
-  Pel* pDst     = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
-  Pel* pDstU    = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx );
-  Pel* pDstV    = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx );
-
-  UInt  iSrcStride  = getStride();
-  UInt  iDstStride  = pcPicYuvDst->getStride();
-  UInt  iDstStrideC = pcPicYuvDst->getCStride();
-
-  //X
-  {
-    //Luma
-    Pel* pDstHor = pDst;
-    Pel* pSrcHor = pSrc;
-    for( x = 0; x < iWidth; x++ )
-      pDstHor[x] = (((pSrcHor[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2;
-  //CbCr
-    Pel* pDstUHor = pDstU;
-    Pel* pDstVHor = pDstV;
-    for( x = 0; x < iWidthC; x++ )
-    {
-      pDstUHor[x] = LINE_CB_COL2;
-      pDstVHor[x] = LINE_CR_COL2;
-    }
-  }
-
-  //Y
-  {
-    //Luma
-    Pel* pDstVer = pDst;
-    Pel* pSrcVer = pSrc;
-    x = 0;
-    for ( y = iHeight; y >= 0; y-- )
-    {
-      pDstVer[x] = (((pSrcVer[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2;
-      pDstVer += iDstStride;
-      pSrcVer += iSrcStride;
-    }
-    //CbCr
-    Pel* pDstVerU = pDstU;
-    Pel* pDstVerV = pDstV;
-    x = 0;
-    for ( y = iHeightC; y >= 0; y-- )
-    {
-      pDstVerU[x] = LINE_CB_COL2;
-      pDstVerV[x] = LINE_CR_COL2;
-      pDstVerU += iDstStrideC;
-      pDstVerV += iDstStrideC;
-    }
-  }
-  
-}
-
-Void TDecCu::xColsetToPic( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth )
-{
-  int       iIdxWidth = (pcCU->getWidth( 0 ) << uiDepth) >> 2;
-  UInt      uiCUAddr  = pcCU->getAddr();
-  PredMode  ePredMode = pcCU->getPredictionMode( 0 );
-  Int       iRect[2][2] = {{0,0}, {0,0}};
-  Int       iColorIdx = 0;
-  UInt      uiPartAddr;
-
-  if ( ePredMode == MODE_INTER )
-  {
-    for (int iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ )
-    {
-      pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRect[1][0], iRect[1][1] );
-      iRect[0][0]  = (g_auiZscanToRaster[uiPartAddr] % iIdxWidth) << 2;
-      iRect[0][1]  = (g_auiZscanToRaster[uiPartAddr] / iIdxWidth) << 2;
-
-#if (VSP_N)
-      {
-        Char cRefVsp = 0x00;
-        Int iRefIdx = pcCU->getCUMvField( RefPicList(0) )->getRefIdx(iPartIdx);
-        if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(0), iRefIdx ) == NUM_VIEW_VSP )
-          cRefVsp |= 0x01;
-        iRefIdx = pcCU->getCUMvField( RefPicList(1) )->getRefIdx(iPartIdx);
-        if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(1), iRefIdx ) == NUM_VIEW_VSP )
-          cRefVsp |= 0x02;
-#if FORCE_REF_VSP
-        if( pcCU->isVspMode(iPartIdx) )
-          cRefVsp |= 0x04;
-#endif
-
-        switch( cRefVsp )
-        {
-        case 0: // INTER
-          iColorIdx = 2;
-          break;
-        case 1: // VSP L0
-          iColorIdx = 4;
-          break;
-        case 2: // VSP L1
-          iColorIdx = 6;
-          break;
-        case 3: // VSP Bi
-          iColorIdx = 7;
-          break;
-#if FORCE_REF_VSP
-        case 4: // VSP Skip
-          iColorIdx = 5;
-          break;
-#endif
-        default:
-          assert(0);
-          break;
-        }
-      }
-#else
-      iColorIdx = 2;
-#endif
-
-      m_ppcYuvReco[uiDepth]->colsetToPicYuv    ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx );
-    }
-  } else {
-    iRect[0][0]=iRect[0][1]=0;
-    iRect[1][0]=pcCU->getWidth(0);
-    iRect[1][1]=pcCU->getHeight(0);
-
-    iColorIdx = ePredMode==MODE_SKIP ? 0 : 1;
-
-    m_ppcYuvReco[uiDepth]->colsetToPicYuv      ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx );
-  }
-
-  switch ( pcCU->getPartitionSize( 0 ) )
-  {
-    case SIZE_2Nx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, false, 4, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    case SIZE_2NxN:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , false, 2, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    case SIZE_Nx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, true , 2, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    case SIZE_NxN:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , true , 2, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_2NxnU:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , false, 1, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_2NxnD:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , false, 3, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_nLx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, true , 1, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_nRx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, true , 3, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    default:
-      break;
-  }
-}
-
-Void TDecCu::xColsetToPicMerge( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth )
-{
-  int       iIdxWidth = (pcCU->getWidth( 0 ) << uiDepth) >> 2;
-  UInt      uiCUAddr  = pcCU->getAddr();
-  PredMode  ePredMode = pcCU->getPredictionMode( 0 );
-  Int       iRect[2][2] = {{0,0}, {0,0}};
-  Int       iColorIdx = 0;
-  UInt      uiPartAddr;
-  UInt      uiMergeIdx;
-  Bool      bSkip     = ePredMode == MODE_SKIP ? true : false;
-
-  if ( ePredMode == MODE_INTER || bSkip )
-  {
-    for (int iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ )
-    {
-      pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRect[1][0], iRect[1][1] );
-      iRect[0][0]  = (g_auiZscanToRaster[uiPartAddr] % iIdxWidth) << 2;
-      iRect[0][1]  = (g_auiZscanToRaster[uiPartAddr] / iIdxWidth) << 2;
-      Bool bMerge  = pcCU->getMergeFlag( iPartIdx );
-
-      if( bSkip || bMerge ) {
-        uiMergeIdx   = pcCU->getMergeIndex( iPartIdx );
-#if (FORCE_REF_VSP)
-        {
-          iColorIdx = bSkip ? 1 : (bMerge ? 5 : 0);
-          Int iRefIdx = pcCU->getCUMvField( RefPicList(0) )->getRefIdx(iPartIdx);
-          char cRefVsp = 0x00;
-          if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(0), iRefIdx ) == NUM_VIEW_VSP )
-            cRefVsp |= 0x01;
-          iRefIdx = pcCU->getCUMvField( RefPicList(1) )->getRefIdx(iPartIdx);
-          if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(1), iRefIdx ) == NUM_VIEW_VSP )
-            cRefVsp |= 0x02;
-
-          if( cRefVsp ) {
-            iColorIdx += 1;
-          } else if ( uiMergeIdx ) {
-            iColorIdx += 3;
-          }
-        }
-#else
-        iColorIdx = 2;
-#endif
-        assert( iColorIdx > 0 && iColorIdx < 10 );
-
-        m_ppcYuvReco[uiDepth]->colsetToPicYuv  ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx );
-
-      } else {
-
-        //Inter Not Merge
-        m_ppcYuvReco[uiDepth]->colsetToPicYuv  ( g_ucCol[0], iRect, pcPicYuv, uiCUAddr, uiZorderIdx );
-
-      }
-    } // end iPartIdx loop
-
-  } else
-  {
-    //Intra , Not Merge Inter
-    iRect[0][0]=iRect[0][1]=0;
-    iRect[1][0]=pcCU->getWidth(0);
-    iRect[1][1]=pcCU->getHeight(0);
-
-    iColorIdx = 0;
-
-    m_ppcYuvReco[uiDepth]->colsetToPicYuv      ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx );
-  }
-
-  switch ( pcCU->getPartitionSize( 0 ) )
-  {
-    case SIZE_2Nx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, false, 4, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    case SIZE_2NxN:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , false, 2, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    case SIZE_Nx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, true , 2, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    case SIZE_NxN:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , true , 2, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_2NxnU:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , false, 1, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_2NxnD:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( true , false, 3, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_nLx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, true , 1, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break; 
-    case SIZE_nRx2N:
-      m_ppcYuvReco[uiDepth]->drawLineToPicYuv  ( false, true , 3, pcPicYuv, uiCUAddr, uiZorderIdx );
-      break;
-    default:
-      break;
-  }
-}
-#endif //DEBUGIMGOUT
Index: anches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/DebugLog.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/DebugLog.h	(revision 192)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#ifndef __DEBUGLOG_H__
-#define __DEBUGLOG_H__
-
-#define OUT_PRED_INFO  0  //pred info(IntraDir/InterDirNum,Idx,Mv) output
-#define ASYMMETRIC_USE 1
-
-#include "TComDataCU.h"
-
-#define DECLOGFILENAME  "debuglogDec.txt"
-
-class DebugLog 
-{
-private:
-    FILE*  m_pfDebugLogFile;
-
-public:
-    DebugLog() { m_pfDebugLogFile = NULL; }
-    ~DebugLog() {}
-
-    bool   DebugLogFileOpen( char* pcFname ) { m_pfDebugLogFile = fopen( pcFname, "wt" ); return (m_pfDebugLogFile!=NULL); }
-    void   DebugLogFileClose()               { if (m_pfDebugLogFile) fclose(m_pfDebugLogFile); m_pfDebugLogFile=NULL; }
-
-    bool   DebugLogOut( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
-};
-
-
-//Colors
-//     Y=Org/2 + YOffset      YOffset  U    V        
-const UChar g_ucCol[11][3] = { {000, 128, 128}, //0 gray scale
-                               {128, 255, 000}, //1 light blue
-                               {128, 255, 128}, //2 lavender
-                               {128, 000, 000}, //3 green yellow
-                               {128, 000, 128}, //4 yellow
-                               {128, 255, 255}, //5 pink
-                               {128, 000, 255}, //6 orange
-                               {064, 000, 255}, //7 red 
-                               {064, 255, 000}, //8 blue
-                               {016, 000, 000}, //9 green
-                               {064, 128, 128}  //10 light gray scale
-                             };
-
-//CU
-#define LINE_LUMA_OFF_COL   g_ucCol[9][0] //9 green
-#define LINE_CB_COL         g_ucCol[9][1]
-#define LINE_CR_COL         g_ucCol[9][2]
-
-//PU
-#define LINE_LUMA_OFF_COL2  g_ucCol[7][0] //7 red
-#define LINE_CB_COL2        g_ucCol[7][1]
-#define LINE_CR_COL2        g_ucCol[7][2]
-
-
-#endif //__DEBUGLOG_H__
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 193)
@@ -76,6 +76,8 @@
   if( ucVspMergePos == VSP_MERGE_POS )
   {
-#if VSP_TEXT_ONLY
-    if( !getSlice()->getSPS()->isDepth() )
+#if VSP_CFG
+    if( getSlice()->getSPS()->getVspDepthPresentFlag() || !getSlice()->getSPS()->isDepth() )
+#else
+    if( !getSlice()->getVspDepthDisableFlag() || !getSlice()->getSPS()->isDepth() )
 #endif
     if( getSlice()->getSPS()->getViewId()!=0 && !bVspMvZeroDone )
@@ -150,7 +152,10 @@
   m_pcTrCoeffCr        = NULL;
 #if ADAPTIVE_QP_SELECTION  
+#if FIX_MEM_LEAKS
+  m_ArlCoeffIsAliasedAllocation = false;
   m_pcArlCoeffY        = NULL;
   m_pcArlCoeffCb       = NULL;
   m_pcArlCoeffCr       = NULL;
+#endif
 #endif
   
@@ -211,4 +216,16 @@
   m_piEdgeDeltaDC1      = NULL;
 #endif
+#endif
+#if OL_DEPTHLIMIT_A0044
+  //add a variable to store the partition information
+  //a 2D array in part_symbol, uidepth format
+  //initialize m_partInfo to OL_END_CU
+  for (Int i=0; i < OL_PART_BUF_SIZE; i++)
+  {
+    for (Int j=0; j < 2; j++)
+    {
+      m_uiPartInfo[i][j] = OL_END_CU;
+    }
+  }
 #endif
 }
@@ -295,4 +312,7 @@
       m_pcArlCoeffCb       = m_pcGlbArlCoeffCb;
       m_pcArlCoeffCr       = m_pcGlbArlCoeffCr;
+#if FIX_MEM_LEAKS
+      m_ArlCoeffIsAliasedAllocation = true;
+#endif
     }
     else
@@ -410,4 +430,12 @@
     if ( m_pcTrCoeffCr        ) { xFree(m_pcTrCoeffCr);         m_pcTrCoeffCr       = NULL; }
 #if ADAPTIVE_QP_SELECTION
+#if FIX_MEM_LEAKS
+    if (!m_ArlCoeffIsAliasedAllocation)
+    {
+      xFree(m_pcArlCoeffY); m_pcArlCoeffY = 0;
+      xFree(m_pcArlCoeffCb); m_pcArlCoeffCb = 0;
+      xFree(m_pcArlCoeffCr); m_pcArlCoeffCr = 0;
+    }
+#endif
     if ( m_pcGlbArlCoeffY     ) { xFree(m_pcGlbArlCoeffY);      m_pcGlbArlCoeffY    = NULL; }
     if ( m_pcGlbArlCoeffCb    ) { xFree(m_pcGlbArlCoeffCb);     m_pcGlbArlCoeffCb   = NULL; }
@@ -516,4 +544,7 @@
 Void TComDataCU::initCU( TComPic* pcPic, UInt iCUAddr )
 {
+#if OL_DEPTHLIMIT_A0044
+  TComDataCU* pcCU     = pcPic->getCU(iCUAddr);
+#endif
 
   m_pcPic              = pcPic;
@@ -732,4 +763,7 @@
     m_apcCUColocated[1] = getSlice()->getRefPic( REF_PIC_LIST_1, 0)->getCU( m_uiCUAddr );
   }
+#if OL_DEPTHLIMIT_A0044
+  setPartDumpFlag (pcCU->getPartDumpFlag());
+#endif
 }
 
@@ -1061,4 +1095,7 @@
   memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition);
   memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition);
+#if OL_DEPTHLIMIT_A0044
+  setPartDumpFlag (pcCU->getPartDumpFlag());
+#endif
 }
 
@@ -2346,4 +2383,8 @@
 #if H0204_QP_PREDICTION
   UInt        lPartIdx, aPartIdx;
+#if FIX_COMP_WARNING_INIT
+  lPartIdx = 0; 
+  aPartIdx = 0;
+#endif
   TComDataCU* cULeft  = getQpMinCuLeft ( lPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
   TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
@@ -3146,5 +3187,9 @@
     RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
-    if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx))
+    if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx)
+#if VSP_N
+                        && getSlice()->getPOC() != getSlice()->getRefPOC(eRefList, iBestRefIdx)
+#endif
+      )
       iAddResiShift++;
   }
@@ -4614,7 +4659,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
@@ -4625,5 +4667,11 @@
       {
         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+#if VSP_N & VSP_BUGFIX
+        Int refPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId);
+        //if( !pcTmpCU->isVspRef( eRefPicList, refId ) )
+        if ( refViewIdx!= m_pcSlice->getViewId() || refPOC != m_pcSlice->getPOC())
+#else
         if (refViewIdx!= m_pcSlice->getViewId())
+#endif
         {
            TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -4643,7 +4691,4 @@
 
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
@@ -4654,5 +4699,11 @@
       {
         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+#if VSP_N & VSP_BUGFIX
+        Int refPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId);
+        //if( !pcTmpCU->isVspRef( eRefPicList, refId ) )
+        if ( refViewIdx!= m_pcSlice->getViewId() || refPOC != m_pcSlice->getPOC())
+#else
         if (refViewIdx!= m_pcSlice->getViewId())
+#endif
         {
            TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -4672,7 +4723,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
@@ -4683,5 +4731,11 @@
       {
         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+#if VSP_N & VSP_BUGFIX
+        Int refPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId);
+        //if( !pcTmpCU->isVspRef( eRefPicList, refId ) )
+        if ( refViewIdx!= m_pcSlice->getViewId() || refPOC != m_pcSlice->getPOC())
+#else
         if (refViewIdx!= m_pcSlice->getViewId())
+#endif
         {
            TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -4700,7 +4754,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
@@ -4711,5 +4762,11 @@
       {
         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+#if VSP_N & VSP_BUGFIX
+        Int refPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId);
+        //if( !pcTmpCU->isVspRef( eRefPicList, refId ) )
+        if ( refViewIdx!= m_pcSlice->getViewId() || refPOC != m_pcSlice->getPOC())
+#else
         if (refViewIdx!= m_pcSlice->getViewId())
+#endif
         {
            TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -4731,7 +4788,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
@@ -4742,5 +4796,11 @@
       {
         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+#if VSP_N & VSP_BUGFIX
+        Int refPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId);
+        //if( !pcTmpCU->isVspRef( eRefPicList, refId ) )
+        if ( refViewIdx!= m_pcSlice->getViewId() || refPOC != m_pcSlice->getPOC())
+#else
         if (refViewIdx!= m_pcSlice->getViewId())
+#endif
         {
            TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -4965,7 +5025,4 @@
   UInt uiLeftPartIdx = uiIdx;
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
@@ -4985,5 +5042,9 @@
           return;
         }
+#if VSP_N & VSP_BUGFIX
+        else if (pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId) != m_pcSlice->getPOC()) // MCP 
+#else
         else // MCP 
+#endif
         {
           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -5006,7 +5067,4 @@
 
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
@@ -5026,5 +5084,9 @@
           return;
         }
+#if VSP_N & VSP_BUGFIX
+        else if (pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId) != m_pcSlice->getPOC()) // MCP 
+#else
         else // MCP 
+#endif
         {
           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -5046,7 +5108,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
@@ -5066,5 +5125,9 @@
           return;
         }
-        else  // MCP 
+#if VSP_N & VSP_BUGFIX
+        else if (pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId) != m_pcSlice->getPOC()) // MCP 
+#else
+        else // MCP 
+#endif
         {
           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -5086,7 +5149,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
@@ -5106,5 +5166,9 @@
           return;
         }
+#if VSP_N & VSP_BUGFIX
+        else if (pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId) != m_pcSlice->getPOC()) // MCP 
+#else
         else // MCP 
+#endif
         {
           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -5128,7 +5192,4 @@
 #endif
   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-#if VSP_N
-  if(pcTmpCU->getSlice()->getViewId() != NUM_VIEW_VSP)
-#endif
   {
     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
@@ -5148,5 +5209,9 @@
           return;
         }
+#if VSP_N & VSP_BUGFIX
+        else if (pcTmpCU->getSlice()->getRefPOC( eRefPicList, refId) != m_pcSlice->getPOC()) // MCP 
+#else
         else // MCP 
+#endif
         {
           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -5753,5 +5818,5 @@
   {
     aiRefIdx[iList] = getCUMvField( RefPicList(iList) )->getRefIdx( uiPartIdx );
-    if( aiRefIdx[iList] >= 0 && getSlice()->getRefViewId( RefPicList(iList), aiRefIdx[iList] ) == NUM_VIEW_VSP )
+    if( aiRefIdx[iList] >= 0 && isVspRef( RefPicList(iList), aiRefIdx[iList] ) )
     {
       iRet |= (iList ? 0x02 : 0x01); // L0=1, L1=2, BI=3
@@ -5802,4 +5867,17 @@
   return iRet; 
 }
+
+Bool TComDataCU::isVspRef ( RefPicList e, Int iRefIdx )
+{
+  if( iRefIdx < 0 ) return false;
+
+  if( getSlice()->getRefPic( e, iRefIdx )->getViewId() == getSlice()->getViewId()
+   && getSlice()->getRefPic( e, iRefIdx )->getPOC()    == getSlice()->getPOC()   )
+  {
+    return true;
+  }
+
+  return false;
+}
 #endif
 
@@ -5866,5 +5944,5 @@
  
 #if AMVP_VSP_UNAVAILABLE
-  if( pcTmpCU != NULL && pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && pcTmpCU->getSlice()->getRefViewId( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) == NUM_VIEW_VSP )
+  if( pcTmpCU != NULL && pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && pcTmpCU->isVspRef( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) )
   {
     return false;
@@ -5908,4 +5986,8 @@
       return false;
     }
+#if VSP_N ///
+    if( pcTmpCU->isVspRef( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) )
+      return false;
+#endif
     iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
     if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List//
@@ -6035,5 +6117,5 @@
 
 #if AMVP_VSP_UNAVAILABLE
-  if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && pcTmpCU->getSlice()->getRefViewId( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) == NUM_VIEW_VSP )
+  if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && pcTmpCU->isVspRef( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) )
   {
     return false;
@@ -6061,4 +6143,8 @@
     if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) )
       return false;
+#if VSP_N ///
+    if( pcTmpCU->isVspRef( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) )
+      return false;
+#endif
     if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List//
     {
@@ -6084,7 +6170,11 @@
       return false;
     }
+#if VSP_N ///
+    if( pcTmpCU->isVspRef( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) )
+      return false;
+#endif
 
 #if VSP_N
-    if( pcTmpCU->getSlice()->getRefViewId( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) == NUM_VIEW_VSP )
+    if( pcTmpCU->isVspRef( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) )
     {
       bRefVsp = true;
@@ -6119,7 +6209,11 @@
       return false;
     }
+#if VSP_N ///
+    if( pcTmpCU->isVspRef( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) )
+      return false;
+#endif
 
 #if VSP_N
-    if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) == NUM_VIEW_VSP )
+    if( pcTmpCU->isVspRef( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) )
     {
       bRefVsp = true;
@@ -6161,23 +6255,13 @@
   Int iColViewIdx, iColRefViewIdx;
   TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx);
-#if VSP_MV_ZERO // shimizu
+#if VSP_N
+  if( pColPic->getSlice(0)->getViewId() == getSlice()->getViewId() && pColPic->getSlice(0)->getPOC() == getSlice()->getPOC() )
+  {
+    return false;
+  }
+#endif
   TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
   iColViewIdx = pColCU->getSlice()->getViewId();
-#if VSP_N
-  if( iColViewIdx == NUM_VIEW_VSP )
-  {
-    return false;
-  }
-#endif
-#else  
-#if VSP_N
-  if( pColPic->getSlice(0)->getViewId() == NUM_VIEW_VSP )
-  {
-    return false;
-  }
-#endif
-  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
-  iColViewIdx = pColCU->getSlice()->getViewId();
-#endif
+
 
   if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr))
@@ -6207,5 +6291,5 @@
     iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewId();
 #if VSP_N
-    if( iColRefViewIdx == NUM_VIEW_VSP )
+    if( iColRefViewIdx == pColCU->getSlice()->getViewId() && pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getPOC() == pColCU->getSlice()->getPOC() )
     {
       continue;
@@ -6351,5 +6435,5 @@
 //  UInt uiColRefViewId = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId();
   UInt uiCurRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId();
-  if( uiCurRefViewId == NUM_VIEW_VSP )
+  if( uiCurRefViewId == m_pcSlice->getViewId() && m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC() == m_pcSlice->getPOC() )
     iScale = 4096;
   else
@@ -6368,5 +6452,5 @@
   {
 #if VSP_MV_ZERO
-    if( uiCurRefViewId == NUM_VIEW_VSP )
+    if( uiCurRefViewId == m_pcSlice->getViewId() && m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC() == m_pcSlice->getPOC() )
       rcMv.setZero();
     else
@@ -6481,4 +6565,10 @@
     return false;
   }
+#if VSP_N ///
+  if( isVspRef( eRefPicList, iRefIdx ) )
+  {
+    return false;
+  }
+#endif
 
   // Prefer a vector crossing us.  Prefer shortest.
@@ -6495,4 +6585,9 @@
     }
     int iColRefPOC = pColCU->getSlice()->getRefPOC(RefPicList(l), iColRefIdx);
+#if VSP_N ///
+    Bool bColVsp    = pColCU->isVspRef( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx() );
+    Bool bColRefVsp = pColCU->isVspRef( RefPicList(l), iColRefIdx );
+    if( ( bColRefVsp && !bColVsp) || (!bColRefVsp &&  bColVsp) )
+#endif
     if( pColCU->getSlice()->getRefViewId( RefPicList(l), iColRefIdx ) != pColCU->getSlice()->getViewId() )
     {
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 193)
@@ -159,4 +159,7 @@
   Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
   Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
+#if FIX_MEM_LEAKS
+  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
+#endif 
 
   static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
@@ -237,4 +240,12 @@
   UInt*         m_uiSliceStartCU;    ///< Start CU address of current slice
   UInt*         m_uiEntropySliceStartCU; ///< Start CU address of current slice
+
+#if OL_DEPTHLIMIT_A0044 
+  //add a variable to store the partition information
+  //a 2D array in uidepth, part_symbol format
+  UInt          m_uiPartInfo[OL_PART_BUF_SIZE][2];
+  UInt          m_uiPartNum;
+  Bool          m_dumpPartInfo;
+#endif 
   
   // -------------------------------------------------------------------------------------------------------------------
@@ -600,4 +611,13 @@
   
   Void          compressMV            ();
+
+#if OL_DEPTHLIMIT_A0044
+  Void        resetPartInfo     () {m_uiPartNum = 0;};
+  Void        incrementPartInfo () {m_uiPartNum ++;};
+  Void        updatePartInfo(UInt uiSymbol, UInt uiDepth) { m_uiPartInfo[m_uiPartNum][0] = uiSymbol; m_uiPartInfo[m_uiPartNum][1] = uiDepth;};
+  UInt*       readPartInfo()                              { return (UInt*)m_uiPartInfo;};
+  Void        setPartDumpFlag(Bool flag)                  { m_dumpPartInfo = flag; };
+  Bool        getPartDumpFlag()                           { return m_dumpPartInfo; };
+#endif
   
   // -------------------------------------------------------------------------------------------------------------------
@@ -665,4 +685,5 @@
   Int           isVspMode ( UInt uiPartIdx );
   Int           isVspMode ( UInt uiPartIdx, TComMv cCompMv );
+  Bool          isVspRef  ( RefPicList e, Int iRefIdx );
 #endif
   
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDepthMapGenerator.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDepthMapGenerator.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComDepthMapGenerator.cpp	(revision 193)
@@ -743,5 +743,5 @@
       {
 #if VSP_N
-        if( pcSlice->getRefViewId( eRefPicList, iPdmRefIdx ) != NUM_VIEW_VSP )
+        if( !pcCU->isVspRef( eRefPicList, iPdmRefIdx ) )
 #endif
         if( pcSlice->getRefPOC( eRefPicList, iPdmRefIdx ) == pcSlice->getPOC())
@@ -846,5 +846,5 @@
   Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
 #if VSP_N
-  Bool          bVsp        = ( pcRefPic->getViewId() == NUM_VIEW_VSP );
+  Bool          bVsp        = pcCU->isVspRef( eRefPicList, iRefIdx );
   AOT(  bInterview &&  bVsp && iRefPoc != pcSlice->getPOC() );
   AOT( !bInterview && !bVsp && iRefPoc == pcSlice->getPOC() );
@@ -947,5 +947,5 @@
   Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
 #if VSP_N
-  Bool          bVsp        = ( pcRefPic->getViewId() == NUM_VIEW_VSP );
+  Bool          bVsp        = pcCU->isVspRef( eRefPicList, iRefIdx );
   AOT(  bInterview &&  bVsp && iRefPoc != pcSlice->getPOC() );
   AOT( !bInterview && !bVsp && iRefPoc == pcSlice->getPOC() );
@@ -1502,6 +1502,6 @@
     Bool            bUsesInterViewPrd = ( abCurrIntView[0] || abCurrIntView[1] );
 #if VSP_N
-    if(( aiCurrRefIdx[0] >= 0 && pcCU->getSlice()->getRefPic( REF_PIC_LIST_0, aiCurrRefIdx[0] )->getViewId() == NUM_VIEW_VSP ) ||
-       ( aiCurrRefIdx[1] >= 0 && pcCU->getSlice()->getRefPic( REF_PIC_LIST_1, aiCurrRefIdx[1] )->getViewId() == NUM_VIEW_VSP )) {
+    if(( aiCurrRefIdx[0] >= 0 && pcCU->isVspRef( REF_PIC_LIST_0, aiCurrRefIdx[0] ) ) ||
+       ( aiCurrRefIdx[1] >= 0 && pcCU->isVspRef( REF_PIC_LIST_1, aiCurrRefIdx[1] ) )) {
       //if refpic is VSP, copy to Original cuurent PDM
       TComPicYuv* pcPdm = pcCU->getPic()->getPredDepthMap();
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.cpp	(revision 193)
@@ -69,7 +69,4 @@
   m_pcResidual        = NULL;
 #endif
-#if DEBUGIMGOUT
-  m_acPicYuvDebug     = NULL;
-#endif
   m_pcPicYuvPred      = NULL;
   m_pcPicYuvResi      = NULL;
@@ -102,8 +99,5 @@
   }
   m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
-#if DEBUGIMGOUT
-  m_acPicYuvDebug    = new TComPicYuv;  m_acPicYuvDebug->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
-#endif
-
+  
   /* there are no SEI messages associated with this picture initially */
   m_SEIs = NULL;
@@ -172,12 +166,4 @@
     delete m_pcResidual;
     m_pcResidual = NULL;
-  }
-#endif
-#if DEBUGIMGOUT
-  if (m_acPicYuvDebug)
-  {
-    m_acPicYuvDebug->destroy();
-    delete m_acPicYuvDebug;
-    m_acPicYuvDebug = NULL;
   }
 #endif
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.h	(revision 193)
@@ -91,7 +91,4 @@
   TComPicYuv*           m_pcResidual;             //  residual buffer (coded or inter-view predicted residual)
 #endif
-#if DEBUGIMGOUT
-  TComPicYuv*           m_acPicYuvDebug;          //  debug image
-#endif
 
   TComPicYuv*           m_pcPicYuvPred;           //  Prediction
@@ -120,4 +117,9 @@
   Int**                 m_aaiCodedScale;
   Int**                 m_aaiCodedOffset;
+
+#if OL_DEPTHLIMIT_A0044
+  UInt*                 m_texPartInfo;
+  UInt                  m_uiTexPartIndex;
+#endif
 
 public:
@@ -183,8 +185,4 @@
 #if HHI_INTER_VIEW_RESIDUAL_PRED
   TComPicYuv*   getResidual()         { return  m_pcResidual; }
-#endif
-
-#if DEBUGIMGOUT
-  TComPicYuv*   getPicYuvRecDbg()     { return  m_acPicYuvDebug; }
 #endif
 
@@ -262,4 +260,13 @@
   Void          removeResidualBuffer    ();
 #endif
+
+#if OL_DEPTHLIMIT_A0044
+  UInt        accessPartInfo        ( UInt count )   { return m_texPartInfo[m_uiTexPartIndex + count]; };
+  Void        incrementTexPartIndex (            )   { m_uiTexPartIndex += 2;    };
+  UInt        getTexPartIndex       ()               { return m_uiTexPartIndex;  };
+  Void        setTexPartIndex       ( UInt idx   )   { m_uiTexPartIndex = idx; };
+  Void        setPartInfo           ( UInt* texPart) { m_texPartInfo    = texPart;  };
+#endif
+
   Bool          getValidSlice                                  (Int sliceID)  {return m_pbValidSlice[sliceID];}
   Int           getSliceGranularityForNDBFilter                ()             {return m_sliceGranularityForNDBFilter;}
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPicSym.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPicSym.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPicSym.cpp	(revision 193)
@@ -126,4 +126,15 @@
   m_apcTComDataCU = NULL;
 
+
+#if FIX_MEM_LEAKS
+  if( m_apcTComTile )
+  {
+    for( i=0; i<(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
+    {
+      if ( m_apcTComTile[i] )  delete m_apcTComTile[i];
+    }
+  }
+#endif
+
   delete [] m_apcTComTile;
   m_apcTComTile = NULL;
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPicYuv.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPicYuv.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPicYuv.h	(revision 193)
@@ -184,13 +184,4 @@
   Void  setChromaTo  ( Pel pVal );  
 
-#if DEBUGIMGOUT
-  // Degub tools
-public:
-  Void colsetToPicYuv   ( const UChar ucColor[3],                 Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-  Void colsetToPicLuma  ( const UChar ucLumaOffCol,               Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-  Void colsetToPicChroma( const UChar ucUCol, const UChar ucVCol, Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-  Void drawLineToPicYuv ( bool bHor, bool bVer, UInt uiSize,      TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-#endif
-
 };// END CLASS DEFINITION TComPicYuv
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPrediction.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPrediction.h	(revision 193)
@@ -95,4 +95,5 @@
   Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
 #endif
+
 #if DEPTH_MAP_GENERATION
   Void xWeightedAveragePdm      ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY );
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComRdCost.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComRdCost.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComRdCost.h	(revision 193)
@@ -377,4 +377,10 @@
   Bool                    m_bUseEstimatedVSD; 
 #endif
+#if LGE_WVSO_A0119
+  Int                     m_iDWeight;
+  Int                     m_iVSOWeight;
+  Int                     m_iVSDWeight;
+  Bool                    m_bUseWVSO;
+#endif
 
   Bool                    m_bUseVSO;
@@ -410,5 +416,14 @@
   Void    setVSOMode( UInt uiIn);
   UInt    getVSOMode( )                  { return m_uiVSOMode; }
-
+#if LGE_WVSO_A0119
+  Void    setUseWVSO ( Bool bIn )         { m_bUseWVSO = bIn; }; 
+  Bool    getUseWVSO ( )                  { return m_bUseWVSO;};
+  Void    setDWeight   ( Int iDWeight   ) { m_iDWeight = iDWeight; };
+  Int     getDWeight   ()                 { return m_iDWeight; };
+  Void    setVSOWeight ( Int iVSOWeight ) { m_iVSOWeight = iVSOWeight; };
+  Int     getVSOWeight ()                 { return m_iVSOWeight; };
+  Void    setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; };
+  Int     getVSDWeight ()                 { return m_iVSDWeight; };
+#endif 
 #if HHI_VSO_DIST_INT
   Void    setAllowNegDist ( Bool bAllowNegDist );
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 193)
@@ -112,4 +112,7 @@
 , m_iViewOrderIdx                 ( 0 )
 #endif
+#if VSP_CFG
+, m_uiNumVspRefPics               ( 0 )
+#endif
 {
   m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
@@ -146,4 +149,10 @@
 #if VSP_SLICE_HEADER
   m_bVspFlag = false;
+#if VSP_CFG
+  memset( m_uiVspRefPos[0], 0, sizeof(UInt)*MAX_NUM_REF_PICS );
+  memset( m_uiVspRefPos[1], 0, sizeof(UInt)*MAX_NUM_REF_PICS );
+#else
+  m_bVspDepthDisableFlag = false;
+#endif
 #endif
 }
@@ -195,4 +204,11 @@
 #if VSP_SLICE_HEADER
   m_bVspFlag = false;
+#if VSP_CFG
+  m_uiNumVspRefPics = 0;
+  memset( m_uiVspRefPos[0], 0, sizeof(UInt)*MAX_NUM_REF_PICS );
+  memset( m_uiVspRefPos[1], 0, sizeof(UInt)*MAX_NUM_REF_PICS );
+#else
+  m_bVspDepthDisableFlag = false;
+#endif
 #endif
 
@@ -544,8 +560,19 @@
   }
 
+#if VSP_CFG
+  UInt cIdxTmp;
+  for( cIdx = 0, cIdxTmp = 0; cIdx <= num_ref_idx_l0_active_minus1; cIdx ++ )
+#else
   for( cIdx = 0; cIdx <= num_ref_idx_l0_active_minus1; cIdx ++ )
+#endif
   {
 #if VSP_N
+#if VSP_CFG
+    Int iVspRefPos = getVspRefPos(REF_PIC_LIST_0, 0);
+    iVspRefPos = ( iVspRefPos > 0 ? iVspRefPos - 1 : -1 );
+    if( pcVspPic && iVspRefPos != -1 && cIdx == (iVspRefPos >= num_ref_idx_l0_active_minus1 ? num_ref_idx_l0_active_minus1 : iVspRefPos) )
+#else
     if( pcVspPic && cIdx == num_ref_idx_l0_active_minus1 )
+#endif
     {
       m_apcRefPicList[0][cIdx] = RefPicSetVspCurr[0];
@@ -555,5 +582,12 @@
     }
     else
+    {
+#if VSP_CFG
+      m_apcRefPicList[0][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(cIdxTmp) ] : refPicListTemp0[cIdxTmp];
+      cIdxTmp++;
+#else
       m_apcRefPicList[0][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(cIdx) ] : refPicListTemp0[cIdx];
+#endif
+    }
 #else
     m_apcRefPicList[0][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(cIdx) ] : refPicListTemp0[cIdx];
@@ -567,8 +601,18 @@
   else
   {
+#if VSP_CFG
+    for( cIdx = 0, cIdxTmp = 0; cIdx <= num_ref_idx_l1_active_minus1; cIdx ++ )
+#else
     for( cIdx = 0; cIdx <= num_ref_idx_l1_active_minus1; cIdx ++ )
+#endif
     {
 #if VSP_N
+#if VSP_CFG
+      Int iVspRefPos = getVspRefPos(REF_PIC_LIST_1, 0);
+      iVspRefPos = ( iVspRefPos > 0 ? iVspRefPos - 1 : -1 );
+      if( pcVspPic && iVspRefPos != -1 && cIdx == (iVspRefPos >= num_ref_idx_l1_active_minus1 ? num_ref_idx_l1_active_minus1 : iVspRefPos) )
+#else
       if( pcVspPic && cIdx == num_ref_idx_l1_active_minus1 )
+#endif
       {
         m_apcRefPicList[1][cIdx] = RefPicSetVspCurr[0];
@@ -578,5 +622,12 @@
       }
       else
+      {
+#if VSP_CFG
+        m_apcRefPicList[1][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(cIdxTmp) ] : refPicListTemp1[cIdxTmp];
+        cIdxTmp++;
+#else
         m_apcRefPicList[1][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(cIdx) ] : refPicListTemp1[cIdx];
+#endif
+      }
 #else
       m_apcRefPicList[1][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(cIdx) ] : refPicListTemp1[cIdx];
@@ -1501,4 +1552,13 @@
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 , m_bUseDMM                   (false)
+#endif
+#if OL_DEPTHLIMIT_A0044
+, m_bDepthPartitionLimiting   (false)
+#endif
+#if VSP_N
+, m_bVspPresentFlag           (false)
+#if VSP_CFG
+, m_bVspDepthPresentFlag      (false)
+#endif
 #endif
 {
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 193)
@@ -45,4 +45,5 @@
 #include "TComRom.h"
 #include "TComList.h"
+
 //! \ingroup TLibCommon
 //! \{
@@ -353,4 +354,8 @@
 #endif
 
+#if OL_DEPTHLIMIT_A0044
+  Bool m_bDepthPartitionLimiting;
+#endif
+
 #if DEPTH_MAP_GENERATION
   UInt  m_uiPredDepthMapGeneration;
@@ -372,4 +377,11 @@
 #if HHI_INTER_VIEW_RESIDUAL_PRED
   TComResidualGenerator* m_pcResidualGenerator;
+#endif
+
+#if VSP_N
+  Bool  m_bVspPresentFlag;
+#if VSP_CFG
+  Bool  m_bVspDepthPresentFlag;
+#endif
 #endif
 
@@ -618,4 +630,9 @@
 #endif
 
+#if OL_DEPTHLIMIT_A0044
+  Void setUseDPL(Bool b) {m_bDepthPartitionLimiting = b; }
+  Bool getUseDPL()       {return m_bDepthPartitionLimiting;}
+#endif
+
   Void initMultiviewSPS      ( UInt uiViewId, Int iViewOrderIdx = 0, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
   Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx );
@@ -660,4 +677,13 @@
   Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
   TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
+#endif
+
+#if VSP_N
+  Void  setVspPresentFlag( Bool b ) { m_bVspPresentFlag = b; }
+  Bool  getVspPresentFlag()         { return m_bVspPresentFlag; }
+#if VSP_CFG
+  Void  setVspDepthPresentFlag( Bool b ) { m_bVspDepthPresentFlag = b; }
+  Bool  getVspDepthPresentFlag()         { return m_bVspDepthPresentFlag; }
+#endif
 #endif
 };
@@ -1277,4 +1303,10 @@
 #if VSP_SLICE_HEADER
   Bool      m_bVspFlag;
+#if VSP_CFG
+  UInt      m_uiNumVspRefPics;
+  UInt      m_uiVspRefPos[2][MAX_NUM_REF_PICS];
+#else
+  Bool      m_bVspDepthDisableFlag;
+#endif
 #endif
 
@@ -1584,4 +1616,13 @@
   Void      setVspFlag          ( Bool val )    { m_bVspFlag = val; }
   Bool      getVspFlag          ()              { return m_bVspFlag; }
+#if VSP_CFG
+  Void      setNumVspRefPics( UInt val )        { m_uiNumVspRefPics = val; }
+  UInt      getNumVspRefPics()                  { return m_uiNumVspRefPics; }
+  Void      setVspRefPos( UInt dir, UInt idx, UInt val )  { m_uiVspRefPos[dir][idx] = val; }
+  UInt      getVspRefPos( UInt dir, UInt idx )            { return m_uiVspRefPos[dir][idx]; }
+#else
+  Void      setVspDepthDisableFlag( Bool val )  { m_bVspDepthDisableFlag = val; }
+  Bool      getVspDepthDisableFlag()            { return m_bVspDepthDisableFlag; }
+#endif
 #endif
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComWedgelet.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComWedgelet.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComWedgelet.h	(revision 193)
@@ -198,5 +198,4 @@
   static UInt xGetSAD16         ( WedgeDistParam* pcDtParam );
   static UInt xGetSAD32         ( WedgeDistParam* pcDtParam );
-  //static UInt xGetSAD64         ( WedgeDistParam* pcDtParam );
 
   static UInt xGetSSE4          ( WedgeDistParam* pcDtParam );
@@ -204,5 +203,4 @@
   static UInt xGetSSE16         ( WedgeDistParam* pcDtParam );
   static UInt xGetSSE32         ( WedgeDistParam* pcDtParam );
-  //static UInt xGetSSE64         ( WedgeDistParam* pcDtParam );
 
 };// END CLASS DEFINITION TComWedgeDist
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComYuv.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComYuv.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComYuv.h	(revision 193)
@@ -213,13 +213,4 @@
 
   __inline Pel  xClip  (Pel x )      { return ( (x < 0) ? 0 : (x > (Pel)g_uiIBDI_MAX) ? (Pel)g_uiIBDI_MAX : x ); }
-
-#if DEBUGIMGOUT
-public:
-  Void colsetToPicYuv   ( const UChar ucColor[3],                 Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-  Void colsetToPicLuma  ( const UChar ucLumaOffCol,               Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-  Void colsetToPicChroma( const UChar ucUCol, const UChar ucVCol, Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-  Void drawLineToPicYuv ( bool bHor, bool bVer, UInt uiSize,      TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 );
-#endif
-
 };// END CLASS DEFINITION TComYuv
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 193)
@@ -44,9 +44,8 @@
 #define VSP_N                             1
 #if VSP_N
-#define VSP_TEXT_ONLY                     1
-#define NUM_VIEW_VSP                      99
+#define VSP_BUGFIX                        1
 #define VSP_N_DUMP                        0
 #define FORCE_REF_VSP                     2   // 0=NotUseVSPSKIP 1:VSPSKIPforFlag 2:VSPSKIPforMergeIdx
-#define VSP_MV_ZERO                       0   // use zero vector for VSP
+#define VSP_MV_ZERO                       1   // use zero vector for VSP
 #if VSP_MV_ZERO
 #define AMVP_VSP_UNAVAILABLE              1
@@ -54,10 +53,11 @@
 #define VSP_MERGE_POS                     5   // position of vsp in merge list (0..5)
 #define NTT_SUBPEL                        1
-#endif
-#define DEBUGIMGOUT                       0   //Debug YUVImage Out
-#define DEBUGLOGOUT                       0   //Debug Log Out
+#define VSP_CFG                           1
+#endif
 
 #define VSP_SLICE_HEADER                  1
+#if !VSP_CFG
 #define VSP_FRAME_INTERVAL                2
+#endif
 
 #define FIXES                             1
@@ -66,7 +66,11 @@
 #define FIX_INIT_ROM                      1
 #define FIX_VIRT_DESTRUCTOR               1
-#define FIX_DBL_CONTROL_DEFAULT           1
+#define FIX_MEM_LEAKS                     1
+#define FIX_VSO_SETUP                     1
+#define FIX_COMP_WARNING_INIT             1
 #define FIX_RDO_MACRO                     1
 #define FIX_LG_RESTRICTEDRESPRED_M24766   1
+#define FIX_REMOVE_TILE_DEPENDENCE        1
+#define FIX_DBL_CONTROL_DEFAULT           1
 
 
@@ -116,5 +120,12 @@
 #define SAIT_VSO_EST_A0033                1 // JCT2-A0033 modification 3
 #define LGE_VSO_EARLY_SKIP_A0093          1 // JCT2-A0093 modification 4
-
+#define LGE_WVSO_A0119                    1 // JCT2-A0119 Depth Metric with a weighted depth fidelity term
+
+#define OL_DEPTHLIMIT_A0044               1 //JCT2-A0044
+#if OL_DEPTHLIMIT_A0044
+#define OL_DO_NOT_LIMIT_INTRA_SLICES_PART 1 //Turn this on to not perform depth limiting for I-SLICES.
+#define OL_END_CU                         MAX_INT //Default for initializing the partition information buffer
+#define OL_PART_BUF_SIZE                  86 //maximum number of possible partition bits in a CU
+#endif
 
 #define HHI_INTERVIEW_SKIP                1
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 193)
@@ -1757,4 +1757,18 @@
       }
     }
+#if VSP_N
+    if( pcSPS->getViewId() )
+    {
+      READ_FLAG( uiCode, "vsp_present_flag" );
+      pcSPS->setVspPresentFlag( (Bool)uiCode );
+#if VSP_CFG
+      if( pcSPS->getVspPresentFlag() )
+      {
+        READ_FLAG( uiCode, "vsp_depth_present_flag" );
+        pcSPS->setVspDepthPresentFlag( (Bool)uiCode );
+      }
+#endif
+    }
+#endif
     READ_FLAG( uiCode, "sps_extension2_flag");
     if (uiCode)
@@ -1781,5 +1795,8 @@
   UInt  uiCode;
   Int   iCode;
-  
+#if VSP_CFG
+  Int   iNumOfVspRefsL0 = 0;
+  Int   iNumOfVspRefsL1 = 0;
+#endif
 #if ENC_DEC_TRACE
   xTraceSliceHeader(rpcSlice);
@@ -2006,4 +2023,41 @@
       READ_UVLC (    uiCode, "aps_id" );  rpcSlice->setAPSId(uiCode);
     }
+
+#if VSP_SLICE_HEADER && VSP_CFG
+    if( rpcSlice->getSPS()->getViewId()!=0 
+     && rpcSlice->getSliceType() != I_SLICE
+     && rpcSlice->getSPS()->getVspPresentFlag()
+      )
+    {
+      if( !rpcSlice->getSPS()->isDepth() || rpcSlice->getSPS()->getVspDepthPresentFlag() )
+      {
+        READ_UVLC( uiCode, "num_vsp_ref_pics");
+        rpcSlice->setVspFlag( uiCode > 0 ? true : false );
+        rpcSlice->setNumVspRefPics( uiCode );
+        //printf("SH:num_vsp_ref_pics(%d)\n",uiCode);
+        for( UInt i = 0; i < rpcSlice->getNumVspRefPics(); i++ )
+        {
+          READ_UVLC( uiCode, "vsp_ref_list0_pos");
+          rpcSlice->setVspRefPos( REF_PIC_LIST_0, i, uiCode );
+          //printf("SH:vsp_ref_list0_pos(%d)\n",uiCode);
+          if( rpcSlice->getSliceType() == B_SLICE )
+          {
+            READ_UVLC( uiCode, "vsp_ref_list1_pos");
+            rpcSlice->setVspRefPos( REF_PIC_LIST_1, i, uiCode );
+            //printf("SH:vsp_ref_list1_pos(%d)\n",uiCode);
+          }
+        }
+        iNumOfVspRefsL0 = ( (rpcSlice->getSPS()->getViewId()==0 
+                         || (!rpcSlice->getSPS()->getVspDepthPresentFlag() && rpcSlice->getSPS()->isDepth()) 
+                         || !rpcSlice->getVspFlag() 
+                         || rpcSlice->getVspRefPos(REF_PIC_LIST_0, 0) == 0 ) ? 0 : 1 );
+        iNumOfVspRefsL1 = ( (rpcSlice->getSPS()->getViewId()==0 
+                         || (!rpcSlice->getSPS()->getVspDepthPresentFlag() && rpcSlice->getSPS()->isDepth()) 
+                         || !rpcSlice->getVspFlag() 
+                         || rpcSlice->getVspRefPos(REF_PIC_LIST_1, 0) == 0 ) ? 0 : 1 );
+      }
+    }
+#endif
+
     if (!rpcSlice->isIntra())
     {
@@ -2011,8 +2065,18 @@
       if (uiCode)
       {
-        READ_CODE (3, uiCode, "num_ref_idx_l0_active_minus1" );  rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 );
+        READ_CODE (3, uiCode, "num_ref_idx_l0_active_minus1" );  
+#if VSP_CFG
+        rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 + iNumOfVspRefsL0 );
+#else
+        rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 );
+#endif
         if (rpcSlice->isInterB())
         {
-          READ_CODE (3, uiCode, "num_ref_idx_l1_active_minus1" );  rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 );
+          READ_CODE (3, uiCode, "num_ref_idx_l1_active_minus1" );  
+#if VSP_CFG
+          rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 + iNumOfVspRefsL1 );
+#else
+          rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 );
+#endif
         }
         else
@@ -2183,5 +2247,10 @@
     if(uiCode)
     {
-      READ_UVLC( uiCode, "num_ref_idx_lc_active_minus1" );      rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 );
+      READ_UVLC( uiCode, "num_ref_idx_lc_active_minus1" );      
+#if VSP_CFG
+      rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 + iNumOfVspRefsL0 );
+#else
+      rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 );
+#endif
       
 #if H0412_REF_PIC_LIST_RESTRICTION
@@ -2348,14 +2417,19 @@
 #endif
 
+#if !VSP_CFG
 #if VSP_SLICE_HEADER
   if( rpcSlice->getSPS()->getViewId()!=0 
-#if VSP_TEXT_ONLY
-      && !(rpcSlice->getSPS()->isDepth()) 
-#endif
+   && rpcSlice->getSPS()->getVspPresentFlag()
     )
   {
     READ_FLAG( uiCode, "vsp_flag" );
     rpcSlice->setVspFlag( uiCode ? true : false );
-  }
+    if( rpcSlice->getVspFlag() )
+    {
+      READ_FLAG( uiCode, "vsp_depth_disable_flag" );
+      rpcSlice->setVspDepthDisableFlag( uiCode ? true : false );
+    }
+  }
+#endif
 #endif
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 193)
@@ -351,6 +351,8 @@
 #if FORCE_REF_VSP==1
     if( pcCU->isSkipped(uiAbsPartIdx) && pcCU->getSlice()->getViewId() != 0 )
-#if VSP_TEXT_ONLY
-    if( !pcCU->getSlice()->getSPS()->isDepth() )
+#if VSP_CFG
+    if( pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
+#else
+    if( !pcCU->getSlice()->getVspDepthDisableFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
 #endif
     {
@@ -385,14 +387,6 @@
     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth )
     {
-#if DEBUGLOGOUT
-      PredMode   eOrgPred = pcCU->getPredictionMode( uiAbsPartIdx );
-#endif
       TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
       pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx );
-#if DEBUGLOGOUT
-      if( eOrgPred == MODE_SKIP )
-        pcCU->setPredModeSubParts( MODE_SKIP, uiAbsPartIdx, uiDepth );
-      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 
       UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
@@ -437,10 +431,4 @@
 #endif
     xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if DEBUGLOGOUT
-#if HHI_MPI
-    if( pcCU->getTextureModeDepth( uiAbsPartIdx ) != uiDepth )
-#endif
-      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
     return;
   }
@@ -472,7 +460,4 @@
 
     xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if DEBUGLOGOUT
-    m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
     return;
   }
@@ -508,7 +493,4 @@
     {
       xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if DEBUGLOGOUT
-      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
       return;
     }
@@ -610,7 +592,4 @@
   setdQPFlag( bCodeDQP );
   xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if DEBUGLOGOUT
-  m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 }
 
@@ -710,7 +689,4 @@
   
   xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
-#if DEBUGIMGOUT
-  xColsetToPicMerge( m_ppcCU[uiDepth], pcPic->getPicYuvRecDbg(), uiAbsPartIdx, uiDepth );
-#endif
 }
 
@@ -724,4 +700,5 @@
   // inter prediction
   m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
+
 #if HHI_MPI
   if( pcCU->getTextureModeDepth( 0 ) != -1 )
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.h	(revision 193)
@@ -46,7 +46,4 @@
 #include "TLibCommon/TComPrediction.h"
 #include "TDecEntropy.h"
-#if DEBUGIMGOUT || DEBUGLOGOUT
-#include "TLibCommon/DebugLog.h"
-#endif
 
 //! \ingroup TLibDecoder
@@ -84,8 +81,4 @@
   virtual ~TDecCu();
   
-#if DEBUGLOGOUT
-  DebugLog            m_cDebug;
-#endif
-
   /// initialize access channels
   Void  init                    ( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction );
@@ -132,8 +125,4 @@
   Void xFillPCMBuffer           (TComDataCU* pCU, UInt absPartIdx, UInt depth);
 #endif
-#if DEBUGIMGOUT
-  Void xColsetToPic             ( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth );
-  Void xColsetToPicMerge        ( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth );
-#endif
 };
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 193)
@@ -310,5 +310,5 @@
 #if VSP_MV_ZERO
           Int iRefIdx = pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx(uiSubPartIdx);
-          if( pcCU->getSlice()->getViewId() && iRefIdx >= 0 && (pcCU->getSlice()->getRefViewId( RefPicList( uiRefListIdx ), iRefIdx ) == NUM_VIEW_VSP) )
+          if( pcCU->getSlice()->getViewId() && iRefIdx >= 0 && pcCU->isVspRef( RefPicList( uiRefListIdx ), iRefIdx ) )
           {
             pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( TComMv(0, 0), pcCU->getPartitionSize( uiSubPartIdx ), uiSubPartIdx, uiDepth, uiPartIdx );
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecGop.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecGop.cpp	(revision 193)
@@ -463,4 +463,11 @@
           printf( "V%d ", pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex ) );
         }
+#if VSP_CFG
+        else if( pcSlice->getViewId() == pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex )
+              && pcSlice->getPOC()    == pcSlice->getRefPOC( RefPicList(iRefList), iRefIndex ) )
+        {
+          printf( "VS " );
+        }
+#endif
         else
         {
@@ -479,4 +486,11 @@
           printf( "V%d ", pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) );
         }
+#if VSP_CFG
+        else if( pcSlice->getViewId() == pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) )
+              && pcSlice->getPOC()    == pcSlice->getRefPOC( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) )
+        {
+          printf( "VS " );
+        }
+#endif
         else
         {
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 193)
@@ -636,13 +636,20 @@
   uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
 #if HHI_MPI
-#if VSP_TEXT_ONLY
+#if VSP_N
   TComDataCU* pcTextCU = pcCU->getSlice()->getSPS()->getUseMVI() ? pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ) : NULL;
   Int aiRefIdxVsp[2] = { pcTextCU ? pcTextCU->getCUMvField( RefPicList(0) )->getRefIdx( uiAbsPartIdx ) : -1,
                          pcTextCU ? pcTextCU->getCUMvField( RefPicList(1) )->getRefIdx( uiAbsPartIdx ) : -1 };
-  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
-    && !( aiRefIdxVsp[0] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(0), aiRefIdxVsp[0] ) == NUM_VIEW_VSP )
-    && !( aiRefIdxVsp[1] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(1), aiRefIdxVsp[1] ) == NUM_VIEW_VSP );
-#else
-  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
+#if VSP_CFG
+  const Bool bMVIAvailable = (pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || pcCU->getSlice()->getViewId()==0) 
+                                ? pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE 
+                                : pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
+                                  && !( aiRefIdxVsp[0] >= pcCU->getSlice()->getNumRefIdx( RefPicList(0) ) )
+                                  && !( aiRefIdxVsp[1] >= pcCU->getSlice()->getNumRefIdx( RefPicList(1) ) );
+#else
+  const Bool bMVIAvailable = pcCU->getSlice()->getVspDepthDisableFlag() ? pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
+                                                                          && !( aiRefIdxVsp[0] >= 0 && pcTextCU->isVspRef( RefPicList(0), aiRefIdxVsp[0] ) )
+                                                                          && !( aiRefIdxVsp[1] >= 0 && pcTextCU->isVspRef( RefPicList(1), aiRefIdxVsp[1] ) ) 
+                                                                        : pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
+#endif
 #endif
   const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : uiNumCand;
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 193)
@@ -102,9 +102,4 @@
   rpcPic->setPicYuvResi( 0 );
   
-#if DEBUGLOGOUT
-  char fname[128];
-  sprintf(fname, "%sV%02d_%05d%s.csv", "DecLog", rpcPic->getSlice(0)->getViewId(), rpcPic->getPOC(), rpcPic->getSlice(0)->getIsDepth() ? "depth":"text");
-  m_pcCuDecoder->m_cDebug.DebugLogFileOpen( fname );
-#endif
 #if ENC_DEC_TRACE
   g_bJustDoIt = g_bEncDecTraceEnable;
@@ -444,7 +439,4 @@
 #endif
   }
-#if DEBUGLOGOUT
-  m_pcCuDecoder->m_cDebug.DebugLogFileClose();
-#endif
 
 }
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 193)
@@ -541,5 +541,4 @@
   }
 #endif
-
 }
 
@@ -986,5 +985,4 @@
         m_pcPicVSP->create( m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
         m_pcPicVSP->setCurrSliceIdx(0);
-        m_pcPicVSP->getCurrSlice()->setViewId( NUM_VIEW_VSP );
         m_pcPicVSP->getCurrSlice()->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx() );
         m_pcPicVSP->getCurrSlice()->setSPS( m_apcSlicePilot->getSPS() );
@@ -1013,5 +1011,4 @@
         m_pcPicAvail->create( m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
         m_pcPicAvail->setCurrSliceIdx(0);
-        m_pcPicAvail->getCurrSlice()->setViewId( 99 );
         m_pcPicAvail->getCurrSlice()->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx() );
         m_pcPicAvail->getCurrSlice()->setSPS( m_apcSlicePilot->getSPS() );
@@ -1302,6 +1299,8 @@
 #if VSP_N
     Bool bUseVsp = (m_viewId!=0);
-#if VSP_TEXT_ONLY
-    if( m_isDepth ) bUseVsp = false;
+#if VSP_CFG
+    if( !pcSlice->getSPS()->getVspDepthPresentFlag() && m_isDepth ) bUseVsp = false;
+#else
+    if( pcSlice->getVspDepthDisableFlag() && m_isDepth ) bUseVsp = false;
 #endif
 #if VSP_SLICE_HEADER
@@ -1312,5 +1311,8 @@
     if( bUseVsp )
 #endif
+    {
       m_pcPicVSP->getCurrSlice()->setPOC( pcPic->getPOC() );
+      m_pcPicVSP->getCurrSlice()->setViewId( pcPic->getViewId() );
+    }
 
     pcSlice->setRefPicListMvc( m_cListPic, apcInterViewRefPics, bUseVsp ? m_pcPicVSP : NULL );
@@ -1423,5 +1425,17 @@
   if( getTAppDecTop()->getUseDepth() )
   {
-    getTAppDecTop()->storeVSPInBuffer( m_pcPicVSP, m_pcPicAvail, pcSlice->getViewId(), pcSlice->getSPS()->getViewOrderIdx(), pcSlice->getPOC(), m_isDepth );
+#if VSP_CFG
+    if( pcSlice->getSPS()->getVspDepthPresentFlag() || !m_isDepth )
+#else
+    if( !pcSlice->getVspDepthDisableFlag() || !m_isDepth )
+#endif
+      getTAppDecTop()->storeVSPInBuffer( m_pcPicVSP, m_pcPicAvail, pcSlice->getViewId(), pcSlice->getSPS()->getViewOrderIdx(), pcSlice->getPOC(), m_isDepth );
+#if VSP_N_DUMP
+    if( m_pcPicVSP && pcSlice->getViewId() != 0 && pcSlice->getNumRefIdx(REF_PIC_LIST_0)!=0){
+        Char acFilenameBase[1024];
+        ::sprintf(acFilenameBase,"ref_dec_%sv%d_%04d.yuv",(m_isDepth?"D":"T"),pcSlice->getViewId(), pcSlice->getPOC());
+        pcSlice->getRefPic(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)-1)->getPicYuvRec()->dump(acFilenameBase,0);
+    }
+#endif
   }
 #endif
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 193)
@@ -695,4 +695,16 @@
     WRITE_FLAG( 1, "base_view_flag" );   
   }
+#if VSP_N
+  if( pcSPS->getViewId() )
+  {
+    WRITE_FLAG( pcSPS->getVspPresentFlag(), "vsp_present_flag" );
+#if VSP_CFG
+    if( pcSPS->getVspPresentFlag() )
+    {
+      WRITE_FLAG( pcSPS->getVspDepthPresentFlag(), "vsp_depth_present_flag" );
+    }
+#endif
+  }
+#endif
   WRITE_FLAG( 0, "sps_extension2_flag" );
 }
@@ -707,4 +719,9 @@
 #if ENC_DEC_TRACE  
   xTraceSliceHeader (pcSlice);
+#endif
+
+#if VSP_CFG
+  Int iNumOfVspRefsL0 = 0;
+  Int iNumOfVspRefsL1 = 0;
 #endif
 
@@ -949,9 +966,42 @@
     }
 
+#if VSP_SLICE_HEADER && VSP_CFG
+    if( pcSlice->getSPS()->getViewId()!=0 
+     && pcSlice->getSliceType() != I_SLICE
+     && pcSlice->getSPS()->getVspPresentFlag()
+      )
+    {
+      if( !pcSlice->getSPS()->isDepth() || pcSlice->getSPS()->getVspDepthPresentFlag() )
+      {
+        WRITE_UVLC( pcSlice->getNumVspRefPics(), "num_vsp_ref_pics");
+        for( UInt i = 0; i < pcSlice->getNumVspRefPics(); i++ )
+        {
+          WRITE_UVLC( pcSlice->getVspRefPos( REF_PIC_LIST_0, i ), "vsp_ref_list0_pos");
+          if( pcSlice->getSliceType() == B_SLICE )
+          {
+            WRITE_UVLC( pcSlice->getVspRefPos( REF_PIC_LIST_1, i ), "vsp_ref_list1_pos");
+          }
+        }
+        iNumOfVspRefsL0 = ( (pcSlice->getSPS()->getViewId()==0 
+                         || (!pcSlice->getSPS()->getVspDepthPresentFlag() && pcSlice->getSPS()->isDepth()) 
+                         || !pcSlice->getVspFlag() 
+                         || pcSlice->getVspRefPos(REF_PIC_LIST_0, 0) == 0 ) ? 0 : 1 );
+        iNumOfVspRefsL1 = ( (pcSlice->getSPS()->getViewId()==0 
+                         || (!pcSlice->getSPS()->getVspDepthPresentFlag() && pcSlice->getSPS()->isDepth()) 
+                         || !pcSlice->getVspFlag() 
+                         || pcSlice->getVspRefPos(REF_PIC_LIST_1, 0) == 0 ) ? 0 : 1 );
+      }
+    }
+#endif
+
     // we always set num_ref_idx_active_override_flag equal to one. this might be done in a more intelligent way 
     if (!pcSlice->isIntra())
     {
       WRITE_FLAG( 1 ,                                             "num_ref_idx_active_override_flag");
+#if VSP_CFG
+      WRITE_CODE( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - 1 - iNumOfVspRefsL0, 3, "num_ref_idx_l0_active_minus1" );
+#else
       WRITE_CODE( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - 1, 3, "num_ref_idx_l0_active_minus1" );
+#endif
     }
     else
@@ -961,5 +1011,9 @@
     if (pcSlice->isInterB())
     {
+#if VSP_CFG
+      WRITE_CODE( pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - 1 - iNumOfVspRefsL1, 3, "num_ref_idx_l1_active_minus1" );
+#else
       WRITE_CODE( pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - 1, 3, "num_ref_idx_l1_active_minus1" );
+#endif
     }
     else
@@ -1050,5 +1104,9 @@
     if(pcSlice->getRefPicListCombinationFlag())
     {
+#if VSP_CFG
+      WRITE_UVLC( pcSlice->getNumRefIdx(REF_PIC_LIST_C) - 1 - iNumOfVspRefsL0,          "num_ref_idx lc_active_minus1");
+#else
       WRITE_UVLC( pcSlice->getNumRefIdx(REF_PIC_LIST_C) - 1,          "num_ref_idx lc_active_minus1");
+#endif
       
 #if H0412_REF_PIC_LIST_RESTRICTION
@@ -1180,16 +1238,19 @@
 #endif
 
+#if !VSP_CFG
 #if VSP_SLICE_HEADER
   if( pcSlice->getSPS()->getViewId()!=0 
-#if VSP_TEXT_ONLY
-      && !(pcSlice->getSPS()->isDepth()) 
-#endif
+   && pcSlice->getSPS()->getVspPresentFlag()
     )
   {
     WRITE_FLAG( pcSlice->getVspFlag()?1:0, "vsp_flag" );
 //    printf("[VSP: %d] ", pcSlice->getVspFlag()?1:0);
-  }
-#endif
-
+    if( pcSlice->getVspFlag() )
+    {
+      WRITE_FLAG( pcSlice->getVspDepthDisableFlag()?1:0 , "vsp_depth_disable_flag" );
+    }
+  }
+#endif
+#endif
 }
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCfg.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCfg.h	(revision 193)
@@ -67,4 +67,10 @@
   Int m_interViewRefPosL0[MAX_NUM_REF_PICS];
   Int m_interViewRefPosL1[MAX_NUM_REF_PICS];
+#if VSP_CFG
+  Int m_numVSPRefPics;
+  Int m_VSPRefPics[MAX_NUM_REF_PICS];
+  Int m_VSPRefPosL0[MAX_NUM_REF_PICS];
+  Int m_VSPRefPosL1[MAX_NUM_REF_PICS];
+#endif
  GOPEntryMvc()
   : m_POC(-1)
@@ -81,4 +87,7 @@
   , m_numRefIdc()
   , m_numInterViewRefPics()
+#if VSP_CFG
+  , m_numVSPRefPics()
+#endif
   {
     ::memset( m_referencePics, 0, sizeof(m_referencePics) );
@@ -88,4 +97,9 @@
     ::memset( m_interViewRefPosL0, 0, sizeof(m_interViewRefPosL0) );
     ::memset( m_interViewRefPosL1, 0, sizeof(m_interViewRefPosL1) );
+#if VSP_CFG
+    ::memset( m_VSPRefPics,  0, sizeof(m_VSPRefPics) );
+    ::memset( m_VSPRefPosL0, 0, sizeof(m_VSPRefPosL0) );
+    ::memset( m_VSPRefPosL1, 0, sizeof(m_VSPRefPosL1) );
+#endif
   }
 };
@@ -204,4 +218,10 @@
   Double    m_dLambdaScaleVSO;
   UInt      m_uiVSOMode;
+#if LGE_WVSO_A0119
+  Bool      m_bUseWVSO;
+  Int       m_iVSOWeight;
+  Int       m_iVSDWeight;
+  Int       m_iDWeight;
+#endif
 #endif
 #if SAIT_VSO_EST_A0033
@@ -210,4 +230,8 @@
 #endif
 
+#if VSP_SLICE_HEADER
+  Bool      m_bUseVSP;
+  Bool      m_bVSPDepthDisable;
+#endif
 
   //====== Tool list ========
@@ -266,5 +290,8 @@
   Int       m_iColumnRowInfoPresent;
   Int       m_iUniformSpacingIdr;
+#if FIX_REMOVE_TILE_DEPENDENCE
+#else
   Int       m_iTileBoundaryIndependenceIdr;
+#endif
   Int       m_iNumColumnsMinus1;
   UInt*     m_puiColumnWidth;
@@ -281,5 +308,5 @@
   Int       m_iWaveFrontSubstreams;
 
-  bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
+  Bool      m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
 
   //====== Weighted Prediction ========
@@ -309,5 +336,9 @@
 #endif
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
-  Bool      m_bUseDMM;
+  Bool     m_bUseDMM;
+#endif
+
+#if OL_DEPTHLIMIT_A0044
+  Bool     m_bDepthPartitionLimiting;
 #endif
 
@@ -466,4 +497,10 @@
   Void      setAllowNegDist                 ( Bool b  )     { m_bAllowNegDist     = b; };
 #endif
+#if LGE_WVSO_A0119
+  Void      setUseWVSO                      ( Bool  b )     { m_bUseWVSO   = b; }
+  Void      setVSOWeight                    ( Int   i )     { m_iVSOWeight = i; }
+  Void      setVSDWeight                    ( Int   i )     { m_iVSDWeight = i; }
+  Void      setDWeight                      ( Int   i )     { m_iDWeight   = i; }
+#endif
 #endif
 
@@ -546,4 +583,10 @@
   Bool      getAllowNegDist                 ()      { return m_bAllowNegDist;     }
 #endif
+#if LGE_WVSO_A0119
+  Bool      getUseWVSO                      ()      { return m_bUseWVSO;     }
+  Int       getVSOWeight                    ()      { return m_iVSOWeight;    }
+  Int       getVSDWeight                    ()      { return m_iVSDWeight;    }
+  Int       getDWeight                      ()      { return m_iDWeight;    }
+#endif
 #endif
 
@@ -571,4 +614,9 @@
 #if HHI_VSO
   Void      setUseVSO                       ( Bool  b )     { m_bUseVSO     = b; }
+#endif
+
+#if VSP_SLICE_HEADER
+  Void      setUseVSP                       ( Bool  b )     { m_bUseVSP     = b; }
+  Void      setVSPDepthDisable              ( Bool  b )     { m_bVSPDepthDisable = b; }
 #endif
 
@@ -623,4 +671,9 @@
 #endif
 
+#if VSP_SLICE_HEADER
+  Bool      getUseVSP                       ()      { return m_bUseVSP; }
+  Bool      getVSPDepthDisable              ()      { return m_bVSPDepthDisable; }
+#endif
+
   Bool      getUseFastEnc                   ()      { return m_bUseFastEnc; }
   Bool      getUseEarlyCU                   ()      { return m_bUseEarlyCU; }
@@ -657,12 +710,12 @@
   Void  setSliceGranularity            ( Int  i )      { m_iSliceGranularity = i;       }
   Int   getSliceGranularity            ()              { return m_iSliceGranularity;    }
-  Void      setLFCrossSliceBoundaryFlag     ( Bool   bValue  )    { m_bLFCrossSliceBoundaryFlag = bValue; }
-  Bool      getLFCrossSliceBoundaryFlag     ()                    { return m_bLFCrossSliceBoundaryFlag;   }
+  Void  setLFCrossSliceBoundaryFlag    ( Bool   bValue  )    { m_bLFCrossSliceBoundaryFlag = bValue; }
+  Bool  getLFCrossSliceBoundaryFlag    ()                    { return m_bLFCrossSliceBoundaryFlag;   }
 
 #if HHI_MPI
-  Void      setUseMVI                  (Bool bVal)     {m_bUseMVI = bVal;}
-#endif
-  Void      setUseSAO                  (Bool bVal)     {m_bUseSAO = bVal;}
-  Bool      getUseSAO                  ()              {return m_bUseSAO;}
+  Void  setUseMVI                      ( Bool bVal )   {m_bUseMVI = bVal;}
+#endif
+  Void  setUseSAO                      ( Bool bVal )   {m_bUseSAO = bVal;}
+  Bool  getUseSAO                      ()              {return m_bUseSAO;}
 #if SAO_UNIT_INTERLEAVING
   Void  setMaxNumOffsetsPerPic                   (Int iVal)            { m_maxNumOffsetsPerPic = iVal; }
@@ -795,6 +848,11 @@
 
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
-  Void setUseDMM( Bool b) { m_bUseDMM = b;    }
-  Bool getUseDMM()        { return m_bUseDMM; }
+  Void      setUseDMM( Bool b) { m_bUseDMM = b;    }
+  Bool      getUseDMM()        { return m_bUseDMM; }
+#endif
+
+#if OL_DEPTHLIMIT_A0044
+  Void      setUseDPL(Bool b) {m_bDepthPartitionLimiting = b; }
+  Bool      getUseDPL()       {return m_bDepthPartitionLimiting;}
 #endif
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 193)
@@ -451,8 +451,38 @@
   TComPic* pcPic = rpcBestCU->getPic();
 
+#if OL_DEPTHLIMIT_A0044
+  TComSPS *sps = pcPic->getSlice(0)->getSPS();
+  TComPic *pcTexture;
+  TComDataCU * pcTextureCU;
+  Bool  depthMapDetect =  false;
+  //UInt         uiPrevTexPartIndex = 0;
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+  Bool bIntraSliceDetect = false;
+#endif
+  Bool bTry2NxN = false;
+  Bool bTryNx2N = false;
+    pcTexture = rpcBestCU->getSlice()->getTexturePic();
+    if(pcTexture != NULL) //depth map being encoded
+    {
+    depthMapDetect = true;
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+      bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType()==I_SLICE);
+#endif
+    if(uiDepth == 0)
+    {
+      pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() );
+      pcTexture->setPartInfo(pcTextureCU->readPartInfo());
+      pcTexture->setTexPartIndex(0); 
+    }
+    }
+    else
+    {
+      depthMapDetect = false;
+    }
+#endif
   // get Original YUV data from picture
   m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() );
 #if FORCE_REF_VSP
-  //Bool bWholeCUCanBeSynthesized = false;
+  Bool bWholeCUCanBeSynthesized = false;
   //Bool bOneSubCUCanNotBeSynthesied = false;
   Bool bSubCUCanBeSynthesized[4];
@@ -476,5 +506,5 @@
     if(iSubCUCanBeSynthesizedCnt == 4)
     {
-      //bWholeCUCanBeSynthesized = true;
+      bWholeCUCanBeSynthesized = true;
     }
     //else if(iSubCUCanBeSynthesizedCnt == 3)
@@ -488,5 +518,5 @@
   // variables for fast encoder decision
   Bool    bEarlySkip  = false;
-  Bool    bTrySplit    = true;
+  Bool    bTrySplit   = true;
   Double  fRD_Skip    = MAX_DOUBLE;
 
@@ -499,5 +529,5 @@
   Bool    bTrySplitDQP  = true;
 
-  static  Double  afCost[ MAX_CU_DEPTH ];
+  static  Double  afCost [ MAX_CU_DEPTH ];
   static  Int      aiNum [ MAX_CU_DEPTH ];
 
@@ -581,5 +611,5 @@
       isAddLowestQP = true; 
       iMinQP = iMinQP - 1;
-       
+
     }
 #endif
@@ -624,4 +654,78 @@
 
       rpcTempCU->initEstData( uiDepth, iQP );
+
+#if OL_DEPTHLIMIT_A0044
+      //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+      if(depthMapDetect && !bIntraSliceDetect && sps->getUseDPL())
+#else
+      if(depthMapDetect && sps->getUseDPL()) //depth map being encoded
+#endif
+      {
+        assert(uiDepth == pcTexture->accessPartInfo(1));
+        if(pcTexture->accessPartInfo(0) == 1) //NxN modes
+        {
+          bTrySplit = true;
+          bTryNx2N = true;
+          bTry2NxN = true;
+          //uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 
+          pcTexture->incrementTexPartIndex(); 
+        }
+        else if(pcTexture->accessPartInfo(0) == 0) //2Nx2N modes
+        {
+          UInt uiTexdepth;
+          UInt temp_uiTexPartIndex;
+          bTrySplit = false;
+
+          //scan ahead till next depth
+          uiTexdepth = pcTexture->accessPartInfo(1);
+          //uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 
+          pcTexture->incrementTexPartIndex();
+          temp_uiTexPartIndex = pcTexture->getTexPartIndex(); //store in case to rewind
+
+          while(uiTexdepth != pcTexture->accessPartInfo(1) && uiTexdepth != 0)
+          {
+            if(pcTexture->accessPartInfo(1) < uiTexdepth)
+            {
+              break;
+            }
+            pcTexture->incrementTexPartIndex(); 
+
+            if(pcTexture->accessPartInfo(1) == OL_END_CU)
+            {
+              pcTexture->setTexPartIndex(temp_uiTexPartIndex); 
+              uiTexdepth++;
+              if(uiTexdepth >= g_uiMaxCUDepth)
+              {      
+                break;
+              }
+            }
+          }
+        }
+        else if(pcTexture->accessPartInfo(0) == OL_END_CU)
+        {
+          bTrySplit = false;
+          bTryNx2N = false;
+          bTry2NxN = false;
+        }
+        else if(pcTexture->accessPartInfo(0) == 2) //2NxN case
+        {
+          bTrySplit = false;
+          bTryNx2N = false;
+          bTry2NxN = true;
+          //uiPrevTexPartIndex = pcTexture->getTexPartIndex();  
+          pcTexture->incrementTexPartIndex(); ;
+        }
+        else if(pcTexture->accessPartInfo(0) == 3) //Nx2N case
+        {
+          bTrySplit = false;
+          bTryNx2N = true;
+          bTry2NxN = false;
+          //uiPrevTexPartIndex = pcTexture->getTexPartIndex();  
+          pcTexture->incrementTexPartIndex(); ;
+        }
+      }
+#endif
+
 
       // do inter modes, SKIP and 2Nx2N
@@ -648,63 +752,96 @@
 #endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
-        rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-        // SKIP
-#if HHI_INTERVIEW_SKIP
-        xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, bFullyRenderedSec );
-#else
-        xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU );
-#endif
-        rpcTempCU->initEstData( uiDepth, iQP );
-
-        // fast encoder decision for early skip
-        if ( m_pcEncCfg->getUseFastEnc() )
+          rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+          // SKIP
+#if HHI_INTERVIEW_SKIP
+          xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, bFullyRenderedSec );
+#else
+          xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU );
+#endif
+          rpcTempCU->initEstData( uiDepth, iQP );
+
+          // fast encoder decision for early skip
+          if ( m_pcEncCfg->getUseFastEnc() )
+          {
+            Int iIdx = g_aucConvertToBit[ rpcBestCU->getWidth(0) ];
+            if ( aiNum [ iIdx ] > 5 && fRD_Skip < EARLY_SKIP_THRES*afCost[ iIdx ]/aiNum[ iIdx ] )
+            {
+              bEarlySkip = true;
+              bTrySplit  = false;
+            }
+          }
+
+          // 2Nx2N, NxN
+          if ( !bEarlySkip )
+          {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec );
+
+#else
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
+#endif
+            rpcTempCU->initEstData( uiDepth, iQP );
+            if(m_pcEncCfg->getUseCbfFastMode())
+            {
+              doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+            }
+
+#if FORCE_REF_VSP==1
+#if VSP_CFG
+            if( rpcBestCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !rpcBestCU->getSlice()->getSPS()->isDepth() )
+#else
+            if( !rpcBestCU->getSlice()->getVspDepthDisableFlag() || !rpcBestCU->getSlice()->getSPS()->isDepth() )
+#endif
+            if( bWholeCUCanBeSynthesized )
+            {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec, false, true ); // VSP
+#else
+              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
+#endif
+              rpcTempCU->initEstData( uiDepth, iQP );
+            }
+#else
+            if( bWholeCUCanBeSynthesized ) // To avoid compiling warning
+            {
+            }
+#endif
+          }
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+        } // uiResPrdId
+#endif
+      } // != I_SLICE
+
+#if OL_DEPTHLIMIT_A0044
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+      if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+      if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
+      {
+        bTrySplitDQP = bTrySplit;
+      }
+      else
+      {
+        if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
         {
-          Int iIdx = g_aucConvertToBit[ rpcBestCU->getWidth(0) ];
-          if ( aiNum [ iIdx ] > 5 && fRD_Skip < EARLY_SKIP_THRES*afCost[ iIdx ]/aiNum[ iIdx ] )
+          if(iQP == iBaseQP)
           {
-            bEarlySkip = true;
-            bTrySplit  = false;
+            bTrySplitDQP = bTrySplit;
           }
         }
-
-        // 2Nx2N, NxN
-        if ( !bEarlySkip )
+        else
         {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-          rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec );
-
-#else
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
-#endif
-          rpcTempCU->initEstData( uiDepth, iQP );
-          if(m_pcEncCfg->getUseCbfFastMode())
-          {
-            doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
-          }
-
-#if FORCE_REF_VSP==1
-#if VSP_TEXT_ONLY
-          if( !rpcBestCU->getSlice()->getSPS()->isDepth() )
-#endif
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec, false, true ); // VSP
-#else
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
-#endif
-            rpcTempCU->initEstData( uiDepth, iQP );
-#endif
+          bTrySplitDQP = bTrySplit;
         }
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-        } // uiResPrdId
-#endif
-      } // != I_SLICE
-
+      }
+#else
 
       if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
@@ -719,4 +856,5 @@
         bTrySplitDQP = bTrySplit;
       }
+#endif
 #if LOSSLESS_CODING
       if (isAddLowestQP && (iQP == lowestQP))
@@ -760,255 +898,537 @@
           Bool bResPredFlag  = ( uiResPrdId > 0 );
 #endif
-        // 2Nx2N, NxN
-        if ( !bEarlySkip )
-        {
-
-        if(!( rpcBestCU->getSlice()->getSPS()->getDisInter4x4()  && (rpcBestCU->getWidth(0)==8) && (rpcBestCU->getHeight(0)==8) ))
-        {
-          if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu)
+          // 2Nx2N, NxN
+          if ( !bEarlySkip )
           {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFullyRenderedSec   );
-#else
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN   );
-#endif
-            rpcTempCU->initEstData( uiDepth, iQP );
-          }
-        }
-        }
-
-        { // 2NxN, Nx2N
-          if(doNotBlockPu)
-          {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFullyRenderedSec   );
-#else
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N  );
-#endif
-            rpcTempCU->initEstData( uiDepth, iQP );
-            if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N )
+
+            if(!( rpcBestCU->getSlice()->getSPS()->getDisInter4x4()  && (rpcBestCU->getWidth(0)==8) && (rpcBestCU->getHeight(0)==8) ))
             {
-              doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
-            }
-          }
-          if(doNotBlockPu)
-          {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxN, bFullyRenderedSec   );
-#else
-            xCheckRDCostInter      ( rpcBestCU, rpcTempCU, SIZE_2NxN  );
-#endif
-            rpcTempCU->initEstData( uiDepth, iQP );
-            if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN)
-            {
-              doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
-            }
-          }
-        }
-
-#if 1
-        //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)
-        if( pcPic->getSlice(0)->getSPS()->getAMPAcc(uiDepth) )
-        {
-#if AMP_ENC_SPEEDUP        
-          Bool bTestAMP_Hor = false, bTestAMP_Ver = false;
-
-#if AMP_MRG
-          Bool bTestMergeAMP_Hor = false, bTestMergeAMP_Ver = false;
-
-          deriveTestModeAMP (rpcBestCU, eParentPartSize, bTestAMP_Hor, bTestAMP_Ver, bTestMergeAMP_Hor, bTestMergeAMP_Ver);
-#else
-          deriveTestModeAMP (rpcBestCU, eParentPartSize, bTestAMP_Hor, bTestAMP_Ver);
-#endif
-
-          //! Do horizontal AMP
-          if ( bTestAMP_Hor )
-          {
-            if(doNotBlockPu)
-            {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-              if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
+              if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu)
               {
-                doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
-              }
-            }
-            if(doNotBlockPu)
-            {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-              if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
-              {
-                doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+                if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+                if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
+                {
+                  if (bTrySplit)
+                  {
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFullyRenderedSec   );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN   );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+#if OL_DEPTHLIMIT_A0044
+                  }//bTrySplit
+                }//depthMapDetect
+                else//do things normally
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFullyRenderedSec   );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN   );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                }
+#endif
               }
             }
           }
-#if AMP_MRG
-          else if ( bTestMergeAMP_Hor ) 
-          {
-            if(doNotBlockPu)
+
+          { // 2NxN, Nx2N
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+            if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+            if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
             {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec, true );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-              if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
+              if (bTryNx2N)
               {
-                doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+#endif
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFullyRenderedSec   );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N  );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+#if OL_DEPTHLIMIT_A0044
+              }//bTryNx2N
+            }//depthMapDetect
+            else//do things normally
+            {
+              if(doNotBlockPu)
+              {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFullyRenderedSec   );
+#else
+                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N  );
+#endif
+                rpcTempCU->initEstData( uiDepth, iQP );
+                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N )
+                {
+                  doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                }
               }
             }
-            if(doNotBlockPu)
+#endif
+
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+            if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+            if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
             {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec, true );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-              if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
+              if (bTry2NxN)
               {
-                doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+#endif
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxN, bFullyRenderedSec   );
+#else
+                  xCheckRDCostInter      ( rpcBestCU, rpcTempCU, SIZE_2NxN  );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN)
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+#if OL_DEPTHLIMIT_A0044
+              }//bTryNx2N
+            }//depthMapDetect
+            else//do things normally
+            {
+              if(doNotBlockPu)
+              {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxN, bFullyRenderedSec   );
+#else
+                xCheckRDCostInter      ( rpcBestCU, rpcTempCU, SIZE_2NxN  );
+#endif
+                rpcTempCU->initEstData( uiDepth, iQP );
+                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN)
+                {
+                  doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                }
               }
             }
+#endif
           }
-#endif
-
-          //! Do horizontal AMP
-          if ( bTestAMP_Ver )
+
+#if 1
+          //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)
+          if( pcPic->getSlice(0)->getSPS()->getAMPAcc(uiDepth) )
           {
-            if(doNotBlockPu)
+#if AMP_ENC_SPEEDUP        
+            Bool bTestAMP_Hor = false, bTestAMP_Ver = false;
+
+#if AMP_MRG
+            Bool bTestMergeAMP_Hor = false, bTestMergeAMP_Ver = false;
+
+            deriveTestModeAMP (rpcBestCU, eParentPartSize, bTestAMP_Hor, bTestAMP_Ver, bTestMergeAMP_Hor, bTestMergeAMP_Ver);
+#else
+            deriveTestModeAMP (rpcBestCU, eParentPartSize, bTestAMP_Hor, bTestAMP_Ver);
+#endif
+
+            //! Do horizontal AMP
+            if ( bTestAMP_Hor )
             {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-              if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+              if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+              if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
               {
-                doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                if (bTry2NxN)
+                {
+#endif
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                    if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
+                    {
+                      doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                    }
+                  }
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                    if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
+                    {
+                      doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                    }
+                  }
+#if OL_DEPTHLIMIT_A0044
+                }//bTry2NxN
+              }//depthMapDetect
+              else//do things normally
+              {
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
               }
+#endif
             }
-            if(doNotBlockPu)
+#if AMP_MRG
+            else if ( bTestMergeAMP_Hor ) 
             {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+              if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+              if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
+              {
+                if (bTry2NxN)
+                {
+#endif
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec, true );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                    if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
+                    {
+                      doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                    }
+                  }
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec, true );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                    if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
+                    {
+                      doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                    }
+                  }
+#if OL_DEPTHLIMIT_A0044
+                }//bTry2NxN
+              }//depthMapDetect
+              else//do things normally
+              {
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec, true );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec, true );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+
+              }
+#endif
             }
-          }
+#endif
+
+            //! Do horizontal AMP
+            if ( bTestAMP_Ver )
+            {
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+              if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+              if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
+              {
+                if (bTryNx2N)
+                {
+#endif
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                    if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
+                    {
+                      doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                    }
+                  }
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                  }
+#if OL_DEPTHLIMIT_A0044
+                }//bTryNx2N
+              }//depthMapDetect
+              else//do things normally
+              {
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                }
+              }
+#endif
+            }
 #if AMP_MRG
-          else if ( bTestMergeAMP_Ver )
-          {
-            if(doNotBlockPu)
+            else if ( bTestMergeAMP_Ver )
             {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec, true );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-              if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
+#if OL_DEPTHLIMIT_A0044 //add code here to select 2NxN or Nx2N or none
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+              if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+              if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
               {
-                doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                if (bTryNx2N)
+                {
+#endif
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec, true );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                    if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
+                    {
+                      doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                    }
+                  }
+                  if(doNotBlockPu)
+                  {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                    rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec, true );
+#else
+                    xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true );
+#endif
+                    rpcTempCU->initEstData( uiDepth, iQP );
+                  }
+#if OL_DEPTHLIMIT_A0044
+                }//bTryNx2N
+              }//depthMapDetect
+              else//do things normally
+              {
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec, true );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                  if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
+                  {
+                    doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
+                  }
+                }
+                if(doNotBlockPu)
+                {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+                  rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec, true );
+#else
+                  xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true );
+#endif
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                }
               }
+#endif
             }
-            if(doNotBlockPu)
-            {
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec, true );
-#else
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true );
-#endif
-              rpcTempCU->initEstData( uiDepth, iQP );
-            }
-          }
-#endif
-
-#else
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec );
-#else
-          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
-#endif
-          rpcTempCU->initEstData( uiDepth, iQP );
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec );
-#else
-          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
-#endif
-          rpcTempCU->initEstData( uiDepth, iQP );
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec );
-#else
-          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
-#endif
-          rpcTempCU->initEstData( uiDepth, iQP );
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-              rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#endif
-#if HHI_INTERVIEW_SKIP
-              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec );
-#else
-          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
-#endif
-          rpcTempCU->initEstData( uiDepth, iQP );
-
-#endif
-        } //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)
+#endif
+
+#else
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFullyRenderedSec );
+#else
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
+#endif
+            rpcTempCU->initEstData( uiDepth, iQP );
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFullyRenderedSec );
+#else
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
+#endif
+            rpcTempCU->initEstData( uiDepth, iQP );
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFullyRenderedSec );
+#else
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
+#endif
+            rpcTempCU->initEstData( uiDepth, iQP );
+#if HHI_INTER_VIEW_RESIDUAL_PRED
+            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
+#if HHI_INTERVIEW_SKIP
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFullyRenderedSec );
+#else
+            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
+#endif
+            rpcTempCU->initEstData( uiDepth, iQP );
+
+#endif
+          } //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)
 #endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
@@ -1026,8 +1446,8 @@
         // speedup for inter frames
 #if HHI_INTERVIEW_SKIP
-      if( ( rpcBestCU->getSlice()->getSliceType() == I_SLICE ||
-               rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
-               rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0   ||
-               rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) && !bFullyRenderedSec ) // avoid very complex intra if it is unlikely
+        if( ( rpcBestCU->getSlice()->getSliceType() == I_SLICE ||
+          rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
+          rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0   ||
+          rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) && !bFullyRenderedSec ) // avoid very complex intra if it is unlikely
 #else
         if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 
@@ -1041,9 +1461,32 @@
           if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
           {
-            if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) )
+#if OL_DEPTHLIMIT_A0044 //add code here to select or deselect NxN mode for Intra
+#if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
+            if(depthMapDetect && !bIntraSliceDetect  && sps->getUseDPL())
+#else
+            if(depthMapDetect  && sps->getUseDPL()) //depth map being encoded
+#endif
             {
-              xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
-              rpcTempCU->initEstData( uiDepth, iQP );
+              if (bTrySplit)
+              {
+
+#endif
+                if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) )
+                {
+                  xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
+                  rpcTempCU->initEstData( uiDepth, iQP );
+                }
+#if OL_DEPTHLIMIT_A0044
+              }//bTrySplit
+            }//depthMapDetect
+            else
+            {
+              if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) )
+              {
+                xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
+                rpcTempCU->initEstData( uiDepth, iQP );
+              }
             }
+#endif
           }
         }
@@ -1101,5 +1544,5 @@
 #endif
     {
-    rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );
+      rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );
     }
 
@@ -1125,5 +1568,5 @@
     }
 #if HHI_INTERVIEW_SKIP
-  rpcBestCU->setRenderableSubParts(bFullyRenderedSec,0,rpcBestCU->getDepth( 0 )) ;
+    rpcBestCU->setRenderableSubParts(bFullyRenderedSec,0,rpcBestCU->getDepth( 0 )) ;
 #endif
   }
@@ -1189,8 +1632,8 @@
   {
 #if LOSSLESS_CODING
-      if (isAddLowestQP && (iQP == iMinQP))
-      {
-        iQP = lowestQP;
-      }
+    if (isAddLowestQP && (iQP == iMinQP))
+    {
+      iQP = lowestQP;
+    }
 #endif
     rpcTempCU->initEstData( uiDepth, iQP );
@@ -1301,5 +1744,5 @@
 #endif
       {           
-      rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
+        rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
       }
 
@@ -1344,5 +1787,5 @@
 #endif
           {
-          rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
+            rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
           }
 #endif
@@ -1393,8 +1836,8 @@
     }                                                                                  // with sub partitioned prediction.
 #if LOSSLESS_CODING
-      if (isAddLowestQP && (iQP == lowestQP))
-      {
-        iQP = iMinQP;
-      }
+    if (isAddLowestQP && (iQP == lowestQP))
+    {
+      iQP = iMinQP;
+    }
 #endif
   } // SPLIT- QP Loop
@@ -1403,9 +1846,9 @@
   if( m_pcRdCost->getUseRenModel() )
   {
-      UInt  uiWidth     = m_ppcRecoYuvBest[uiDepth]->getWidth   ( );
-      UInt  uiHeight    = m_ppcRecoYuvBest[uiDepth]->getHeight  ( );
-      Pel*  piSrc       = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 );
-      UInt  uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride  ( );
-      m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
+    UInt  uiWidth     = m_ppcRecoYuvBest[uiDepth]->getWidth   ( );
+    UInt  uiHeight    = m_ppcRecoYuvBest[uiDepth]->getHeight  ( );
+    Pel*  piSrc       = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 );
+    UInt  uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride  ( );
+    m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
 #endif
@@ -1608,6 +2051,12 @@
 #if HHI_MPI
     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
-#endif
+    {
+#endif
+
     m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
+
+#if HHI_MPI
+    }
+#endif
   }
   else
@@ -1624,5 +2073,8 @@
 
     if( ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
+    {
       m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
+    }
+
     if( !pcCU->getSlice()->isIntra() )
     {
@@ -1631,6 +2083,8 @@
 #if FORCE_REF_VSP==1
       if( (pcCU->isSkipped( uiAbsPartIdx ) || pcCU->isVspMode( uiAbsPartIdx )) && pcCU->getSlice()->getViewId() != 0 )
-#if VSP_TEXT_ONLY
-      if( !pcCU->getSlice()->getSPS()->isDepth() )
+#if VSP_CFG
+      if( pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
+#else
+      if( !pcCU->getSlice()->getVspDepthDisableFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
 #endif
       {
@@ -1647,7 +2101,4 @@
       m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 );
       finishCU(pcCU,uiAbsPartIdx,uiDepth);
-#if DEBUGLOGOUT
-      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
       xRestoreDepthWidthHeight( pcCU );
       return;
@@ -1694,4 +2145,5 @@
 #if HHI_MPI
   if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
+{
 #endif
   if( !pcCU->getSlice()->isIntra() )
@@ -1700,7 +2152,9 @@
 
 #if FORCE_REF_VSP==1
-    if( (pcCU->isSkipped( uiAbsPartIdx ) || pcCU->isVspMode( uiAbsPartIdx )) && pcCU->getSlice()->getViewId() != 0 )
-#if VSP_TEXT_ONLY
-    if( !pcCU->getSlice()->getSPS()->isDepth() )
+    if( (pcCU->isSkipped( uiAbsPartIdx ) || pcCU->isVspMode( uiAbsPartIdx )) && pcCU->getSlice()->getViewId() != 0 )]
+#if VSP_CFG
+    if( pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
+#else
+    if( !pcCU->getSlice()->getVspDepthDisableFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
 #endif
     {
@@ -1709,4 +2163,7 @@
 #endif
   }
+#if HHI_MPI
+}
+#endif
   
   if( pcCU->isSkipped( uiAbsPartIdx ) )
@@ -1715,4 +2172,11 @@
 #endif
   {
+#if OL_DEPTHLIMIT_A0044
+    if(pcCU->getPartDumpFlag())
+    {
+      pcCU->updatePartInfo(0,uiDepth);
+      pcCU->incrementPartInfo();
+    }
+#endif
     m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 );
 #if HHI_INTER_VIEW_RESIDUAL_PRED
@@ -1720,7 +2184,4 @@
 #endif
     finishCU(pcCU,uiAbsPartIdx,uiDepth);
-#if DEBUGLOGOUT
-    m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
     return;
   }
@@ -1730,7 +2191,4 @@
   {
     finishCU(pcCU,uiAbsPartIdx,uiDepth);
-#if DEBUGLOGOUT
-    m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
     return;
   }
@@ -1753,7 +2211,4 @@
       // Encode slice finish
       finishCU(pcCU,uiAbsPartIdx,uiDepth);
-#if DEBUGLOGOUT
-      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
       return;
     }
@@ -1779,7 +2234,4 @@
   // --- write terminating bit ---
   finishCU(pcCU,uiAbsPartIdx,uiDepth);
-#if DEBUGLOGOUT
-  m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 }
 
@@ -2613,6 +3065,9 @@
       }
 #if VSP_N
-#if !(!VSP_TEXT_ONLY && FORCE_REF_VSP==2)
-      else // inter
+#if VSP_CFG
+      else if( (!rpcTempCU->getSlice()->getSPS()->getVspDepthPresentFlag() && rpcTempCU->getSlice()->getViewId() ) || FORCE_REF_VSP!=2 ) // inter
+#else
+      else if( rpcTempCU->getSlice()->getVspDepthDisableFlag() || FORCE_REF_VSP!=2 ) // inter
+#endif
       {
         Int aiRefIdx[2] = {NOT_VALID, NOT_VALID};
@@ -2620,5 +3075,9 @@
         {
           aiRefIdx[iList] = pcTextureCU->getCUMvField( RefPicList(iList) )->getRefIdx( rpcTempCU->getZorderIdxInCU() + ui );
-          if( aiRefIdx[iList] >= 0 && pcTextureCU->getSlice()->getRefViewId( RefPicList(iList), aiRefIdx[iList] ) == NUM_VIEW_VSP )
+#if VSP_CFG
+          if( aiRefIdx[iList] >= rpcTempCU->getSlice()->getNumRefIdx( RefPicList(iList) ) )
+#else
+          if( aiRefIdx[iList] >= 0 && pcTextureCU->isVspRef( RefPicList(iList), aiRefIdx[iList] ) )
+#endif
           {
             return;
@@ -2630,5 +3089,4 @@
         //}
       }
-#endif
 #endif
     }
@@ -2830,6 +3288,8 @@
 #if FORCE_REF_VSP==1
   if( (pcCU->isSkipped( 0 ) || pcCU->isVspMode( 0 )) && pcCU->getSlice()->getViewId() != 0 )
-#if VSP_TEXT_ONLY
-  if( !pcCU->getSlice()->getSPS()->isDepth() )
+#if VSP_CFG
+  if( pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
+#else
+  if( !pcCU->getSlice()->getVspDepthDisableFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
 #endif
     m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.h	(revision 193)
@@ -46,7 +46,4 @@
 #include "TLibCommon/TComBitCounter.h"
 #include "TLibCommon/TComDataCU.h"
-#if DEBUGLOGOUT
-#include "TLibCommon/DebugLog.h"
-#endif
 
 #include "TEncEntropy.h"
@@ -116,8 +113,4 @@
 
 public:
-#if DEBUGLOGOUT
-  DebugLog                m_cDebug;
-#endif
-
   /// copy parameters from encoder class
   Void  init                ( TEncTop* pcEncTop );
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 193)
@@ -1370,5 +1370,5 @@
 #if VSP_MV_ZERO
           Int iRefIdx = pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx(uiSubPartIdx);
-          if( !(pcCU->getSlice()->getViewId() && iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList( uiRefListIdx ), iRefIdx ) == NUM_VIEW_VSP) )
+          if( !(pcCU->getSlice()->getViewId() && iRefIdx >= 0 && pcCU->isVspRef( RefPicList( uiRefListIdx ), iRefIdx )) )
           {
 #endif
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 193)
@@ -332,15 +332,45 @@
 #endif
 
+#if VSP_SLICE_HEADER && VSP_CFG
+      pcSlice->setNumVspRefPics( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numVSPRefPics );
+      pcSlice->setVspFlag( m_pcEncTop->getUseVSP() && pcSlice->getNumVspRefPics() > 0 );
+      for( UInt i = 0; i < pcSlice->getNumVspRefPics(); i++ )
+      {
+        pcSlice->setVspRefPos( REF_PIC_LIST_0, i, m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_VSPRefPosL0[i] );
+        if( pcSlice->getSliceType() == B_SLICE )
+        {
+          pcSlice->setVspRefPos( REF_PIC_LIST_1, i, m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_VSPRefPosL1[i] );
+        }
+      }
+#endif
+
 #if VSP_N
+#if VSP_CFG
+      Int NumberOfVspRefsL0 = ( ( pcPic->getViewId()==0
+                                || (m_pcEncTop->getVSPDepthDisable() && m_pcEncTop->getIsDepth())
+#if VSP_SLICE_HEADER
+                                || !pcSlice->getVspFlag()
+#endif
+                                || pcSlice->getVspRefPos( REF_PIC_LIST_0, 0 ) == 0
+                              ) ? 0 : 1 );
+      Int NumberOfVspRefsL1 = ( ( pcPic->getViewId()==0
+                                || (m_pcEncTop->getVSPDepthDisable() && m_pcEncTop->getIsDepth())
+#if VSP_SLICE_HEADER
+                                || !pcSlice->getVspFlag()
+#endif
+                                || pcSlice->getVspRefPos( REF_PIC_LIST_1, 0 ) == 0
+                              ) ? 0 : 1 );
+      pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive + NumberOfVspRefsL0, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs() + NumberOfVspRefsL0) ) );
+      pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive + NumberOfVspRefsL1, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs() + NumberOfVspRefsL1) ) );
+#else
       Int NumberOfVspRefs = ( ( pcPic->getViewId()==0
-#if VSP_TEXT_ONLY
-                                || m_pcEncTop->getIsDepth()
-#endif
+                                || (m_pcEncTop->getVSPDepthDisable() && m_pcEncTop->getIsDepth())
 #if VSP_SLICE_HEADER
-                                || !m_pcEncTop->getUseVSP()
+                                || !pcSlice->getVspFlag()
 #endif
                               ) ? 0 : 1 );
       pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive + NumberOfVspRefs, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs() + NumberOfVspRefs) ) );
       pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive + NumberOfVspRefs, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs() + NumberOfVspRefs) ) );
+#endif
 #else
       pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
@@ -373,16 +403,31 @@
 #if VSP_N
       Bool bUseVsp = (pcPic->getViewId()!=0);
-#if VSP_TEXT_ONLY
-      if( m_pcEncTop->getIsDepth() ) bUseVsp = false;
-#endif
+      if( m_pcEncTop->getVSPDepthDisable() && m_pcEncTop->getIsDepth() ) bUseVsp = false;
 #if VSP_SLICE_HEADER
+#if VSP_CFG
+      if( !pcSlice->getVspFlag() ) bUseVsp = false;
+#else
       if( !m_pcEncTop->getUseVSP() ) bUseVsp = false;
 #endif
+#endif
+
+#if VSP_SLICE_HEADER
+      if( bUseVsp )
+#endif
+      {
+        m_pcEncTop->getVSPBuf()->getCurrSlice()->setPOC( pcPic->getPOC() );
+        m_pcEncTop->getVSPBuf()->getCurrSlice()->setViewId( pcPic->getViewId() );
+      }
+
       pcSlice->setRefPicListMvc( rcListPic, apcInterViewRefPics, bUseVsp ? m_pcEncTop->getVSPBuf() : NULL );
 #else
       pcSlice->setRefPicListMvc( rcListPic, apcInterViewRefPics );
 #endif
+
+#if !VSP_CFG
 #if VSP_SLICE_HEADER
-      pcSlice->setVspFlag( bUseVsp );
+      pcSlice->setVspFlag( m_pcEncTop->getUseVSP() );
+      pcSlice->setVspDepthDisableFlag( m_pcEncTop->getVSPDepthDisable() );
+#endif
 #endif
 
@@ -471,4 +516,5 @@
     Int iVSOMode = m_pcEncTop->getVSOMode();
     m_pcRdCost->setVSOMode( iVSOMode  );
+
 #if HHI_VSO_DIST_INT
     m_pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() );
@@ -491,5 +537,8 @@
     m_pcRdCost->setDepthPicYuv   ( m_pcEncTop->getEncTop()->getPicYuvFromView( pcSlice->getViewId(), pcSlice->getPOC(), true, false ) );
 #endif
-
+#if LGE_WVSO_A0119
+    Bool bUseWVSO  = m_pcEncTop->getUseWVSO();
+    m_pcRdCost->setUseWVSO( bUseWVSO );
+#endif
 
   }
@@ -1157,24 +1206,26 @@
           m_pcSbacCoder->load( &pcSbacCoders[0] );
 
-#if DEBUGLOGOUT
-        char fname[128];
-        sprintf(fname, "%sV%02d_%05d%s.csv", "Log", pcSlice->getViewId(), uiPOCCurr, pcSlice->getIsDepth() ? "depth":"text");
-        getSliceEncoder()->getCUEncoder()->m_cDebug.DebugLogFileOpen( fname );
-#endif
-
         pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength );
         if (!bEntropySlice)
         {
+#if OL_DEPTHLIMIT_A0044 //start dumping partition information
+          m_pcSliceEncoder->setPartDumpFlag(1);
+#endif
           pcSlice->setTileLocationCount ( 0 );
           m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info.
+#if OL_DEPTHLIMIT_A0044 //stop dumping partition information
+          m_pcSliceEncoder->setPartDumpFlag(0);
+#endif
         }
         else
         {
+#if OL_DEPTHLIMIT_A0044 //start dumping partition information
+          m_pcSliceEncoder->setPartDumpFlag(1);
+#endif
           m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info.
-        }
-
-#if DEBUGLOGOUT
-        getSliceEncoder()->getCUEncoder()->m_cDebug.DebugLogFileClose();
-#endif
+#if OL_DEPTHLIMIT_A0044 //stop dumping partition information
+          m_pcSliceEncoder->setPartDumpFlag(0);
+#endif
+        }
 
         {
@@ -2187,4 +2238,11 @@
         printf( "V%d ", pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex ) );
       }
+#if VSP_CFG
+      else if( pcSlice->getViewId() == pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex )
+            && pcSlice->getPOC()    == pcSlice->getRefPOC( RefPicList(iRefList), iRefIndex ) )
+      {
+        printf( "VS " );
+      }
+#endif
       else
       {
@@ -2203,4 +2261,11 @@
         printf( "V%d ", pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) );
       }
+#if VSP_CFG
+      else if( pcSlice->getViewId() == pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) )
+            && pcSlice->getPOC()    == pcSlice->getRefPOC( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) )
+      {
+        printf( "VS " );
+      }
+#endif
       else
       {
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.h	(revision 193)
@@ -146,5 +146,4 @@
   Void freeAPS     (TComAPS* pAPS, TComSPS* pSPS);
   Void allocAPS    (TComAPS* pAPS, TComSPS* pSPS);
-
 protected:
   Void encodeAPS   (TComAPS* pcAPS, TComOutputBitstream& APSbs, TComSlice* pcSlice);            //!< encode APS syntax elements
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 193)
@@ -580,4 +580,7 @@
 {
   PartSize eSize         = pcCU->getPartitionSize( uiAbsPartIdx );
+#if OL_DEPTHLIMIT_A0044
+  UInt uiSymbol;
+#endif
   if ( pcCU->isIntra( uiAbsPartIdx ) )
   {
@@ -585,5 +588,20 @@
     {
       m_pcBinIf->encodeBin( eSize == SIZE_2Nx2N? 1 : 0, m_cCUPartSizeSCModel.get( 0, 0, 0 ) );
-    }
+#if OL_DEPTHLIMIT_A0044
+      if(pcCU->getPartDumpFlag())
+      {
+        uiSymbol = (UInt)(eSize == SIZE_2Nx2N? 1 : 0);
+        pcCU->updatePartInfo(uiSymbol?0:1,uiDepth); //0 for 2Nx2N and 1 for NxN
+        pcCU->incrementPartInfo();
+      }
+#endif
+    }
+#if OL_DEPTHLIMIT_A0044
+    if(pcCU->getPartDumpFlag() && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth && !pcCU->getSlice()->isIntra())
+    {
+      pcCU->updatePartInfo(0,uiDepth); //0 for 2Nx2N and 1 for NxN
+      pcCU->incrementPartInfo();
+    }
+#endif
     return;
   }
@@ -591,12 +609,19 @@
   switch(eSize)
   {
-    case SIZE_2Nx2N:
+  case SIZE_2Nx2N:
     {
       m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );
+#if OL_DEPTHLIMIT_A0044
+      if(pcCU->getPartDumpFlag())
+      {
+        pcCU->updatePartInfo(0,uiDepth); //0 for 2Nx2N
+        pcCU->incrementPartInfo();
+      }
+#endif
       break;
     }
-    case SIZE_2NxN:
-    case SIZE_2NxnU:
-    case SIZE_2NxnD:
+  case SIZE_2NxN:
+  case SIZE_2NxnU:
+  case SIZE_2NxnD:
     {
       m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
@@ -623,9 +648,16 @@
         }
       }
+#if OL_DEPTHLIMIT_A0044
+      if(pcCU->getPartDumpFlag())
+      {
+        pcCU->updatePartInfo(2,uiDepth); //2 for 2NxN
+        pcCU->incrementPartInfo();
+      }
+#endif
       break;
     }
-    case SIZE_Nx2N:
-    case SIZE_nLx2N:
-    case SIZE_nRx2N:
+  case SIZE_Nx2N:
+  case SIZE_nLx2N:
+  case SIZE_nRx2N:
     {
       m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
@@ -656,7 +688,14 @@
         }
       }
+#if OL_DEPTHLIMIT_A0044
+      if(pcCU->getPartDumpFlag())
+      {
+        pcCU->updatePartInfo(3,uiDepth); //3 for Nx2N
+        pcCU->incrementPartInfo();
+      }
+#endif
       break;
     }
-    case SIZE_NxN:
+  case SIZE_NxN:
     {
       if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getSlice()->getSPS()->getDisInter4x4() && pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
@@ -665,8 +704,25 @@
         m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
         m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 2) );
+#if OL_DEPTHLIMIT_A0044
+        if(pcCU->getPartDumpFlag())
+        {
+          pcCU->updatePartInfo(1,uiDepth); //2Nx2N here since we disable NxN in Inter
+          pcCU->incrementPartInfo();         
+        }
+#endif
+      }
+      else
+      {
+#if OL_DEPTHLIMIT_A0044
+        if(pcCU->getPartDumpFlag())
+        {
+          pcCU->updatePartInfo(0,uiDepth); //2Nx2N here since we disable NxN in Inter
+          pcCU->incrementPartInfo();
+        }
+#endif
       }
       break;
     }
-    default:
+  default:
     {
       assert(0);
@@ -785,13 +841,20 @@
   uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
 #if HHI_MPI
-#if VSP_TEXT_ONLY
+#if VSP_N
   TComDataCU* pcTextCU = pcCU->getSlice()->getSPS()->getUseMVI() ? pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ) : NULL;
   Int aiRefIdxVsp[2] = { pcTextCU ? pcTextCU->getCUMvField( RefPicList(0) )->getRefIdx( uiAbsPartIdx ) : -1,
                          pcTextCU ? pcTextCU->getCUMvField( RefPicList(1) )->getRefIdx( uiAbsPartIdx ) : -1 };
-  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
-    && !( aiRefIdxVsp[0] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(0), aiRefIdxVsp[0] ) == NUM_VIEW_VSP )
-    && !( aiRefIdxVsp[1] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(1), aiRefIdxVsp[1] ) == NUM_VIEW_VSP );
-#else
-  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
+#if VSP_CFG
+  const Bool bMVIAvailable = (pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || pcCU->getSlice()->getViewId()==0) 
+                                ? pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
+                                : pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
+                                  && !( aiRefIdxVsp[0] >= pcCU->getSlice()->getNumRefIdx( RefPicList(0) ) )
+                                  && !( aiRefIdxVsp[1] >= pcCU->getSlice()->getNumRefIdx( RefPicList(1) ) );
+#else
+  const Bool bMVIAvailable = pcCU->getSlice()->getVspDepthDisableFlag() ? pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
+                                                                          && !( aiRefIdxVsp[0] >= 0 && pcTextCU->isVspRef( RefPicList(0), aiRefIdxVsp[0] ) )
+                                                                          && !( aiRefIdxVsp[1] >= 0 && pcTextCU->isVspRef( RefPicList(1), aiRefIdxVsp[1] ) )
+                                                                        : pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
+#endif
 #endif
   if( bMVIAvailable )
@@ -858,4 +921,14 @@
   assert( uiCtx < 3 );
   m_pcBinIf->encodeBin( uiCurrSplitFlag, m_cCUSplitFlagSCModel.get( 0, 0, uiCtx ) );
+#if OL_DEPTHLIMIT_A0044
+  if(pcCU->getPartDumpFlag())
+  {
+    if(pcCU->getSlice()->isIntra() || (!pcCU->getSlice()->isIntra() && uiCurrSplitFlag!=0))
+    {
+      pcCU->updatePartInfo(uiCurrSplitFlag,uiDepth);
+      pcCU->incrementPartInfo();
+    }
+  }
+#endif
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tSplitFlag\n" )
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 193)
@@ -882,6 +882,8 @@
 #if FORCE_REF_VSP==1
         if( pcCU->getSlice()->getViewId() != 0 )
-#if VSP_TEXT_ONLY
-        if( !pcCU->getSlice()->getSPS()->isDepth() )
+#if VSP_CFG
+        if( pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
+#else
+        if( !pcCU->getSlice()->getVspDepthDisableFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
 #endif
           m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
@@ -1145,11 +1147,24 @@
   if ( m_pcRdCost->getUseVSO() )
   {
-    ruiDist += m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
+#if LGE_WVSO_A0119
+    if ( m_pcRdCost->getUseWVSO() )
+    {    
+      Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+      Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+      Dist iD = (Dist) m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
+      Dist iVSO = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
+      ruiDist += (iDWeight * iD + iVSOWeight * iVSO) / ( iDWeight + iVSOWeight);
+    }
+    else
+#endif
+    {
+      ruiDist += m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
+    }
   }
   else
 #endif
   {
-  ruiDist += m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
-}
+    ruiDist += m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
+  }
 }
 
@@ -1918,4 +1933,13 @@
 
             uiSad = (Dist) ( m_pcRdCost->getDistPart( piPred, uiStride, piOrg, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset), pcVirRec->getStride(), uiWidth, uiHeight ) );
+#if LGE_WVSO_A0119
+            if ( m_pcRdCost->getUseWVSO() )
+            {    
+              Int iDWeight = m_pcRdCost->getDWeight();
+              Int iVSDWeight = m_pcRdCost->getVSDWeight();
+              Dist iD = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
+              uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight);
+            }
+#endif
           }
           else
@@ -1924,4 +1948,13 @@
             Bool bSad = !m_pcRdCost->getUseRenModel();
             uiSad = m_pcRdCost->getDistVS(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, bSad, 0 );
+#if LGE_WVSO_A0119
+            if ( m_pcRdCost->getUseWVSO() )
+            {    
+              Int iDWeight = m_pcRdCost->getDWeight()*m_pcRdCost->getDWeight();
+              Int iVSDWeight = m_pcRdCost->getVSOWeight()*m_pcRdCost->getVSOWeight();
+              Dist iD = (Dist) m_pcRdCost->getDistPart( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
+              uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight);
+            }
+#endif
           }
 
@@ -2960,5 +2993,5 @@
       {
 #if VSP_MV_ZERO
-        bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp) == NUM_VIEW_VSP);
+        bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(eRefPicList, iRefIdxTemp));
         //if( bIsVsp && !bWholeCUCanBeSynthesized )
         //{
@@ -2969,5 +3002,9 @@
         if( pcCU->getResPredFlag( 0 ))
         {
-          if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp))
+          if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp)
+#if VSP_N
+          && pcCU->getSlice()->getPOC() != pcCU->getSlice()->getRefPOC(eRefPicList, iRefIdxTemp)
+#endif
+            )
           { // subtract residual prediction from original in motion search
             if(!bLastResiFlag)
@@ -3068,5 +3105,5 @@
               {
 #if VSP_MV_ZERO
-                if( pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp) == NUM_VIEW_VSP )
+                if( pcCU->getSlice()->getViewId() && pcCU->isVspRef(eRefPicList, iRefIdxTemp) )
                 {
                   cMvTemp[1][iRefIdxTemp].setZero();
@@ -3214,5 +3251,5 @@
       {
 #if VSP_MV_ZERO
-        bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, bestBiPRefIdxL1) == NUM_VIEW_VSP);
+        bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_1, bestBiPRefIdxL1));
 
         if( bIsVsp )
@@ -3314,5 +3351,5 @@
         {
 #if VSP_MV_ZERO
-          bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp) == NUM_VIEW_VSP);
+          bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(eRefPicList, iRefIdxTemp));
           //if( bIsVsp && !bWholeCUCanBeSynthesized )
           //{
@@ -3343,7 +3380,15 @@
 
           iPredFrom = iBestRefIdx >= 0 ? 3 : 1;
-          if(iBestRefIdx >= 0 && pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0, iBestRefIdx))
+          if(iBestRefIdx >= 0 && pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0, iBestRefIdx)
+#if VSP_N
+                              && pcCU->getSlice()->getPOC() != pcCU->getSlice()->getRefPOC(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0, iBestRefIdx)
+#endif
+            )
             iAddResiShift++;
-          if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp))
+          if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp)
+#if VSP_N
+          && pcCU->getSlice()->getPOC() != pcCU->getSlice()->getRefPOC(eRefPicList, iRefIdxTemp)
+#endif
+            )
             iAddResiShift++;
           iAddResiShift = (pcCU->getSlice()->getPPS()->getUseWP() || iPredFrom != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
@@ -3420,5 +3465,5 @@
           {
 #if VSP_MV_ZERO
-            bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_0, iRefIdxBi[0]) == NUM_VIEW_VSP);
+            bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_0, iRefIdxBi[0]));
 
             if( !bIsVsp )
@@ -3435,5 +3480,5 @@
 #endif
 #if VSP_MV_ZERO
-              bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, iRefIdxBi[1]) == NUM_VIEW_VSP);
+              bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_1, iRefIdxBi[1]));
 
               if( !bIsVsp )
@@ -3606,5 +3651,5 @@
       
 #if VSP_MV_ZERO
-      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_0, iRefIdxBi[0]) == NUM_VIEW_VSP);
+      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_0, iRefIdxBi[0]));
       if( !bIsVsp )
       {
@@ -3614,5 +3659,5 @@
 #if VSP_MV_ZERO
       }
-      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, iRefIdxBi[1]) == NUM_VIEW_VSP);
+      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_1, iRefIdxBi[1]));
       if( !bIsVsp )
       {
@@ -3638,5 +3683,5 @@
       
 #if VSP_MV_ZERO
-      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_0, iRefIdx[0]) == NUM_VIEW_VSP);
+      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_0, iRefIdx[0]));
       if( !bIsVsp )
       {
@@ -3662,5 +3707,5 @@
       
 #if VSP_MV_ZERO
-      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, iRefIdx[1]) == NUM_VIEW_VSP);
+      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->isVspRef(REF_PIC_LIST_1, iRefIdx[1]));
       if( !bIsVsp )
       {
@@ -4655,4 +4700,13 @@
     {
       uiDistortion = m_pcRdCost->getDistVS( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight     , false, 0 );
+#if LGE_WVSO_A0119
+      if ( m_pcRdCost->getUseWVSO() )
+      {    
+        Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+        Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+        Dist iD   = (Dist) m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight      );
+        uiDistortion = (iDWeight * iD + iVSOWeight * (Dist)uiDistortion) / ( iDWeight + iVSOWeight);
+      }
+#endif
     }
     else    
@@ -5014,4 +5068,13 @@
   {
     uiDistortionBest = m_pcRdCost->getDistVS  ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight, false, 0    );
+#if LGE_WVSO_A0119
+    if ( m_pcRdCost->getUseWVSO() )
+    {    
+      Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+      Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+      Dist iD        = (Dist) m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight      );
+      uiDistortionBest = (iDWeight * iD + iVSOWeight * (Dist) uiDistortionBest) / ( iDWeight + iVSOWeight);
+    }
+#endif
   }
   else
@@ -5249,4 +5312,13 @@
         TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
         uiDistY = m_pcRdCost->getDistPart( m_pTempPel, 1<< uiLog2TrSize, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiAbsPartIdx), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiAbsPartIdx), pcVirRec->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize );
+#if LGE_WVSO_A0119
+        if ( m_pcRdCost->getUseWVSO() )
+        {    
+          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+          Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
+          Dist iD   = (Dist) m_pcRdCost->getDistPart( m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight );
+          uiDistY = (iDWeight * iD + iVSDWeight * (Dist)uiDistY) / ( iDWeight + iVSDWeight);
+        }
+#endif
       }
       else
@@ -5254,4 +5326,13 @@
       {      
         uiDistY = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false, 0 ); // initialized with zero residual distortion
+#if LGE_WVSO_A0119
+        if ( m_pcRdCost->getUseWVSO() )
+        {    
+          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+          Dist iD   = (Dist) m_pcRdCost->getDistPart( m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight );
+          uiDistY = (iDWeight * iD + iVSOWeight * (Dist)uiDistY) / ( iDWeight + iVSOWeight);
+        }
+#endif
       }
     }
@@ -5299,4 +5380,13 @@
           TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
           uiNonzeroDistY = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), pcVirRec->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiAbsPartIdx ), pcVirOrg->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiAbsPartIdx ), pcVirRec->getStride(), 1<< uiLog2TrSize,    1<< uiLog2TrSize );
+#if LGE_WVSO_A0119
+          if ( m_pcRdCost->getUseWVSO() )
+          {    
+            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+            Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
+            Dist iD = (Dist) m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight );
+            uiNonzeroDistY = (iDWeight * iD + iVSDWeight * (Dist) uiNonzeroDistY) / ( iDWeight + iVSDWeight);
+          }
+#endif
         }
         else
@@ -5306,4 +5396,13 @@
           uiNonzeroDistY = m_pcRdCost->getDistVS( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),
                                                   pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize,   1<< uiLog2TrSize, false, 0 );
+#if LGE_WVSO_A0119
+          if ( m_pcRdCost->getUseWVSO() )
+          {    
+            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+            Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+            Dist iD = (Dist) m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight );
+            uiNonzeroDistY = (iDWeight * iD + iVSOWeight * (Dist) uiNonzeroDistY) / ( iDWeight + iVSOWeight);
+          }
+#endif
         }
       }
@@ -6003,6 +6102,8 @@
 #if FORCE_REF_VSP==1
     if( pcCU->getSlice()->getViewId() != 0 )
-#if VSP_TEXT_ONLY
-    if( !pcCU->getSlice()->getSPS()->isDepth() )
+#if VSP_CFG
+    if( pcCU->getSlice()->getSPS()->getVspDepthPresentFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
+#else
+    if( !pcCU->getSlice()->getVspDepthDisableFlag() || !pcCU->getSlice()->getSPS()->isDepth() )
 #endif
       m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
@@ -6400,4 +6501,13 @@
           TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
           uiActDist = m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
+#if LGE_WVSO_A0119
+          if ( m_pcRdCost->getUseWVSO() )
+          {    
+            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+            Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
+            Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
+            uiActDist = (iDWeight * iD + iVSDWeight * (Dist) uiActDist) / ( iDWeight + iVSDWeight);
+          }
+#endif // LGE_WVSO_A0119
         }
         else       
@@ -6405,4 +6515,13 @@
         {        
           uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
+#if LGE_WVSO_A0119
+          if ( m_pcRdCost->getUseWVSO() )
+          {    
+            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+            Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+            Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
+            uiActDist = (iDWeight * iD + iVSOWeight * (Dist) uiActDist) / ( iDWeight + iVSOWeight);
+          }
+#endif // LGE_WVSO_A0119
         }
 #else // FIX_RDO_MACRO
@@ -6413,4 +6532,13 @@
           TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
           uiActDist = m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
+#if LGE_WVSO_A0119
+          if ( m_pcRdCost->getUseWVSO() )
+          {    
+            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+            Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
+            Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
+            uiActDist = (iDWeight * iD + iVSDWeight * (Dist) uiActDist) / ( iDWeight + iVSDWeight);
+          }
+#endif // LGE_WVSO_A0119
         }
         else       
@@ -6418,4 +6546,13 @@
         {        
           uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
+#if LGE_WVSO_A0119
+          if ( m_pcRdCost->getUseWVSO() )
+          {    
+            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+            Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+            Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
+            uiActDist = (iDWeight * iD + iVSOWeight * (Dist) uiActDist) / ( iDWeight + iVSOWeight);
+          }
+#endif // LGE_WVSO_A0119
         }
 #endif // SAIT_VSO_EST_A0033 <-- wrong #endif should be removed
@@ -6527,4 +6664,13 @@
         TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
         uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
+#if LGE_WVSO_A0119
+        if ( m_pcRdCost->getUseWVSO() )
+        {    
+          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+          Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
+          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
+          uiActDist = (iDWeight * iD + iVSDWeight * (Int) uiActDist) / ( iDWeight + iVSDWeight);
+        }
+#endif
       }
       else
@@ -6532,4 +6678,13 @@
       {      
         uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
+#if LGE_WVSO_A0119
+        if ( m_pcRdCost->getUseWVSO() )
+        {    
+          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
+          uiActDist = (iDWeight * iD + iVSOWeight * (Int) uiActDist) / ( iDWeight + iVSOWeight);
+        }
+#endif
       }
     }
@@ -6593,4 +6748,13 @@
         TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
         uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiAbsPtIdx), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiAbsPtIdx), pcVirRec->getStride(), uiWidth, uiHeight );
+#if LGE_WVSO_A0119
+        if ( m_pcRdCost->getUseWVSO() )
+        {    
+          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+          Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
+          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
+          uiActDist = (iDWeight * iD + iVSDWeight * (Int) uiActDist) / ( iDWeight + iVSDWeight);
+        }
+#endif
       }
       else
@@ -6598,4 +6762,13 @@
       {      
         uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
+#if LGE_WVSO_A0119
+        if ( m_pcRdCost->getUseWVSO() )
+        {    
+          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
+          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
+          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
+          uiActDist = (iDWeight * iD + iVSOWeight * (Int) uiActDist) / ( iDWeight + iVSOWeight);
+        }
+#endif
       }
     }
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 193)
@@ -376,5 +376,19 @@
   m_pcRdCost->setDisparityCoeff( m_pcCfg->getDispCoeff() );
 #endif
-
+#if LGE_WVSO_A0119
+  if( m_pcCfg->getUseWVSO() && m_pcCfg->isDepthCoder() )
+  {
+
+    Int iDWeight, iVSOWeight, iVSDWeight;
+    iDWeight = m_pcCfg->getDWeight();
+    iVSOWeight = m_pcCfg->getVSOWeight();
+    iVSDWeight = m_pcCfg->getVSDWeight();
+
+    m_pcRdCost->setDWeight( iDWeight );
+    m_pcRdCost->setVSOWeight( iVSOWeight );
+    m_pcRdCost->setVSDWeight( iVSDWeight );
+
+  }
+#endif
 #if RDOQ_CHROMA_LAMBDA 
 // for RDOQ
@@ -831,4 +845,8 @@
 #endif
 
+#if OL_DEPTHLIMIT_A0044 //stop dumping partition information
+    m_bDumpPartInfo = 0;
+    pcCU->setPartDumpFlag(m_bDumpPartInfo);
+#endif
 
     // inherit from TR if necessary, select substream to use.
@@ -1290,4 +1308,8 @@
 
     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );    
+#if OL_DEPTHLIMIT_A0044
+    pcCU->setPartDumpFlag(m_bDumpPartInfo);
+    pcCU->resetPartInfo();
+#endif
 #if !REMOVE_TILE_DEPENDENCE
     if( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSlice.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSlice.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSlice.h	(revision 193)
@@ -101,4 +101,7 @@
   
   UInt                    m_uiSliceIdx;
+#if OL_DEPTHLIMIT_A0044 //flag to signal to start dumping
+  Bool                    m_bDumpPartInfo;
+#endif
 public:
   TEncSlice();
@@ -128,4 +131,7 @@
   UInt    getSliceIdx()         { return m_uiSliceIdx;                    }
   Void    setSliceIdx(UInt i)   { m_uiSliceIdx = i;                       }
+#if OL_DEPTHLIMIT_A0044 //flag to signal to start dumping
+  Void    setPartDumpFlag(Bool flag) { m_bDumpPartInfo = flag;};
+#endif
 };
 
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.cpp	(revision 193)
@@ -87,6 +87,6 @@
 #if VSP_SLICE_HEADER
   m_bUseVSP = false;
-#endif
-
+  m_bVSPDepthDisable = false;
+#endif
 }
 
@@ -198,14 +198,10 @@
   m_pcPicVSP = new TComPic;
   m_pcPicVSP->create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
-  //m_pcPicVSP->getCurrSlice()->setViewId( this->getViewId() );
-  m_pcPicVSP->getCurrSlice()->setViewId( NUM_VIEW_VSP );
   m_pcPicVSP->getCurrSlice()->setViewOrderIdx( m_iViewOrderIdx );
 
   m_pcPicAvail = new TComPic;
   m_pcPicAvail->create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
-  m_pcPicAvail->getCurrSlice()->setViewId( 99 );
   m_pcPicAvail->getCurrSlice()->setViewOrderIdx( m_iViewOrderIdx );
 #endif
-
 }
 
@@ -854,4 +850,7 @@
   m_cSPS.setUseDMM( m_bUseDMM );
 #endif
+#if OL_DEPTHLIMIT_A0044
+  m_cSPS.setUseDPL( m_bDepthPartitionLimiting );
+#endif
 #if HHI_MPI
   m_cSPS.setUseMVI( m_bUseMVI );
@@ -894,4 +893,10 @@
     }
   }
+#if VSP_N
+  m_cSPS.setVspPresentFlag( m_bUseVSP );
+#if VSP_CFG
+  m_cSPS.setVspDepthPresentFlag( m_bVSPDepthDisable ? false : true );
+#endif
+#endif
 }
 
@@ -1185,5 +1190,9 @@
 
     // # substreams is "per tile" when tiles are independent.
+#if FIX_REMOVE_TILE_DEPENDENCE
+    if ( m_iWaveFrontSynchro )
+#else
     if (m_iTileBoundaryIndependenceIdr && m_iWaveFrontSynchro)
+#endif
     {
       m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams * (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1));
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.h	(revision 193)
@@ -150,8 +150,4 @@
 #endif
 
-#if VSP_SLICE_HEADER
-  Bool                    m_bUseVSP;
-#endif
-
 protected:
   Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
@@ -251,9 +247,4 @@
 #endif
 
-#if VSP_SLICE_HEADER
-  Void                    setUseVSP   ( Bool val ) { m_bUseVSP = val; }
-  Bool                    getUseVSP             () { return m_bUseVSP; }
-#endif
-
   // -------------------------------------------------------------------------------------------------------------------
   // encoder function
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp	(revision 193)
@@ -42,4 +42,7 @@
   m_iWidth             = -1;
   m_iHeight            = -1;
+#if FIX_VSO_SETUP
+  m_iUsedHeight        = -1; 
+#endif
   m_iNumOfBaseViews    = -1;
   m_iSampledWidth      = -1;
@@ -434,16 +437,25 @@
 {
   AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews );
+#if FIX_VSO_SETUP
+  AOF( pcPicYuvVideoData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvVideoData->getWidth() == m_iWidth );
+  AOF( pcPicYuvDepthData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvDepthData->getWidth() == m_iWidth );
+#else
   AOF( pcPicYuvVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvVideoData->getWidth() == m_iWidth );
   AOF( pcPicYuvDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvDepthData->getWidth() == m_iWidth );
+#endif
 
   pcPicYuvVideoData->extendPicBorder();
 
-  
-
-
+#if FIX_VSO_SETUP
+  TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth,      m_iUsedHeight,      m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] );
+  TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] );
+  TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] );
+  TRenFilter::copy          (               pcPicYuvDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(),  m_iWidth,      m_iUsedHeight,      m_apiCurDepthPel [ iViewNum],     m_aiCurDepthStrides [iViewNum]    );
+#else
   TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] );
   TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] );
   TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] );
   TRenFilter::copy          (               pcPicYuvDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(),  m_iWidth,      m_iHeight,      m_apiCurDepthPel [ iViewNum],     m_aiCurDepthStrides [iViewNum]    );
+#endif
 
   // Used for rendering reference pic from original video data
@@ -453,4 +465,11 @@
   if ( m_abSetupVideoFromOrgForView[iViewNum] )
   {
+#if FIX_VSO_SETUP
+    AOF( pcPicYuvOrgVideoData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgVideoData->getWidth() == m_iWidth );
+    pcPicYuvOrgVideoData->extendPicBorder();
+    TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgVideoData->getStride() , pcPicYuvOrgVideoData->getStride() , m_iWidth,      m_iUsedHeight,      m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] );
+    TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] );
+    TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] );
+#else
     AOF( pcPicYuvOrgVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgVideoData->getWidth() == m_iWidth );
     pcPicYuvOrgVideoData->extendPicBorder();
@@ -458,10 +477,16 @@
     TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] );
     TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] );
+#endif
   }
 
   if ( m_abSetupDepthFromOrgForView[iViewNum] )
   {
+#if FIX_VSO_SETUP
+    AOF( pcPicYuvOrgDepthData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgDepthData->getWidth() == m_iWidth );
+    TRenFilter::copy          (               pcPicYuvOrgDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(),  m_iWidth,     m_iUsedHeight,      m_apiOrgDepthPel [ iViewNum],     m_aiOrgDepthStrides [iViewNum]    );
+#else
     AOF( pcPicYuvOrgDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgDepthData->getWidth() == m_iWidth );
     TRenFilter::copy          (               pcPicYuvOrgDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(),  m_iWidth,     m_iHeight,      m_apiOrgDepthPel [ iViewNum],     m_aiOrgDepthStrides [iViewNum]    );
+#endif
   }
 }
@@ -471,4 +496,8 @@
 {
   AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels );
+
+#if FIX_VSO_SETUP
+  m_apcRenModels[iModelNum]->setupPart( m_uiHorOff, m_iUsedHeight );
+#endif
 
   // Switch model  to original data for setup if given to render reference
@@ -476,5 +505,4 @@
   for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ )
   {
-
     Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx];
     Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx];
@@ -492,5 +520,9 @@
   }
 
+#if FIX_VSO_SETUP
+  m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false );
+#else
   m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false, m_uiHorOff );
+#endif
 
   // Setup to Org
@@ -513,5 +545,9 @@
 
     // setup keeping reference rendered from original data
+#if FIX_VSO_SETUP
+    m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true );
+#else
     m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true, m_uiHorOff);
+#endif
   }
 }
@@ -543,9 +579,19 @@
 
 
-Void  
+#if FIX_VSO_SETUP
+Void
+TRenModel::setupPart ( UInt uiHorOff, Int iUsedHeight )
+{
+  AOT( iUsedHeight > m_iHeight );     
+  m_uiHorOff    = uiHorOff; 
+  m_iUsedHeight = iUsedHeight; 
+}
+#else
+Void
 TRenModel::setHorOffset     ( UInt uiHorOff )
 {
-    m_uiHorOff = uiHorOff; 
-}
+  m_uiHorOff = uiHorOff; 
+}
+#endif
 
 #if LGE_VSO_EARLY_SKIP_A0093
@@ -560,5 +606,10 @@
 
   AOT( iWidth  + iStartPosX > m_iWidth  );
+#if FIX_VSO_SETUP
+  AOT( iHeight + iStartPosY > m_iUsedHeight );
+#else
   AOT( iHeight + iStartPosY > m_iHeight );
+#endif
+
   AOT( iStartPosX < 0);
   AOT( iStartPosY < 0);
@@ -593,5 +644,9 @@
 
   iWidth  = min(iWidth , m_iWidth  - iStartPosX );
+#if FIX_VSO_SETUP
+  iHeight = min(iHeight, m_iUsedHeight - iStartPosY );
+#else
   iHeight = min(iHeight, m_iHeight - iStartPosY );
+#endif
 
   AOT( iStartPosX < 0);
@@ -629,5 +684,9 @@
 TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
 {
+#if FIX_VSO_SETUP
+  m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv );
+#else
   m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv, m_uiHorOff );
+#endif
 }
 
@@ -635,5 +694,5 @@
 TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
 {
-#if HHI_VSO_SPEEDUP_A0033
+#if HHI_VSO_SPEEDUP_A0033 && !FIX_VSO_SETUP
   m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv, m_uiHorOff );
 #else
@@ -646,8 +705,16 @@
 {
   TComPicYuv cPicYuvSynth;
+#if FIX_VSO_SETUP
+  cPicYuvSynth.create( m_iWidth, m_iUsedHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#else
   cPicYuvSynth.create( m_iWidth, m_iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#endif
 
   TComPicYuv cPicYuvTempRef;
+#if FIX_VSO_SETUP
+  cPicYuvTempRef.create( m_iWidth, m_iUsedHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
+#else
   cPicYuvTempRef.create( m_iWidth, m_iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
+#endif
 
   Int64 iSSEY = 0;
@@ -657,4 +724,12 @@
   for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++)
   {
+#if FIX_VSO_SETUP
+    m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth );    
+    m_apcCurRenModels[iCurModel]->getRefVideo  ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef   );
+
+    iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(),  m_iWidth,      m_iUsedHeight     , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() );
+    iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr()  , cPicYuvTempRef.getCStride());
+    iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr()  , cPicYuvTempRef.getCStride());
+#else
     m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth, 0 );
     TComPicYuv* pcPicYuvRef = &cPicYuvTempRef;
@@ -664,4 +739,5 @@
     iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iHeight >> 1, pcPicYuvRef->getCbAddr()  , pcPicYuvRef->getCStride());
     iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iHeight >> 1, pcPicYuvRef->getCrAddr()  , pcPicYuvRef->getCStride());
+#endif
   }
 
@@ -700,3 +776,2 @@
   }
 }
-
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.h	(revision 193)
@@ -62,8 +62,12 @@
 
   // Set horizontal offset
+#if FIX_VSO_SETUP
+  Void  setupPart        ( UInt uiHorOff, Int iUsedHeight );
+#else
   Void  setHorOffset     ( UInt uiHorOff );
+#endif
 
   // Set Mode
-  Void  setErrorMode     ( Int iView, Int iContent, int iPlane );
+  Void  setErrorMode     ( Int iView, Int iContent, Int iPlane );
 
   // Get Distortion, set Data
@@ -100,4 +104,8 @@
   Int m_iSampledWidth;
   Int m_iPad;
+#if FIX_VSO_SETUP
+  Int m_iUsedHeight;   // height currently used in buffer, whereas m_iHeight is the total height of the buffer
+#endif
+
 
   Int m_iNumOfBaseViews;
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 193)
@@ -44,4 +44,8 @@
   m_iHeight = -1;
   m_iStride = -1;
+#if FIX_VSO_SETUP
+  m_iUsedHeight = -1; 
+  m_iHorOffset  = -1; 
+#endif
   m_iMode   = -1;
   m_iPad    = PICYUV_PAD;
@@ -90,5 +94,5 @@
 {
 #ifdef LGE_VSO_EARLY_SKIP_A0093
-  if (m_pbHorSkip) 
+  if ( m_pbHorSkip ) 
   {
     delete[] m_pbHorSkip;
@@ -99,5 +103,19 @@
   if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0];
   if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1];
+
+#if FIX_MEM_LEAKS
+  if ( m_pcOutputSamples    ) delete[] m_pcOutputSamples   ;
+#else
   if ( m_pcOutputSamples    ) delete   m_pcOutputSamples   ;
+#endif
+
+#if FIX_MEM_LEAKS
+  if ( m_piInvZLUTLeft  ) delete[] m_piInvZLUTLeft ;
+  if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight;
+
+  if ( m_aapiRefVideoPel[0] ) delete[] ( m_aapiRefVideoPel[0] - ( m_aiRefVideoStrides[0] * m_iPad + m_iPad ) );
+  if ( m_aapiRefVideoPel[1] ) delete[] ( m_aapiRefVideoPel[1] - ( m_aiRefVideoStrides[1] * m_iPad + m_iPad ) );
+  if ( m_aapiRefVideoPel[2] ) delete[] ( m_aapiRefVideoPel[2] - ( m_aiRefVideoStrides[2] * m_iPad + m_iPad ) );
+#endif
 }
 
@@ -179,5 +197,9 @@
   Int iOffsetX = ( iViewPos == VIEWPOS_RIGHT ) ? 1 : 0;
 
+#if FIX_VSO_SETUP
+  for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ )
+#else
   for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+#endif
   {
     if ( iViewPos == VIEWPOS_RIGHT )
@@ -223,7 +245,21 @@
 
 }
-
-template <BlenMod iBM, Bool bBitInc> Void
+#if FIX_VSO_SETUP
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::setupPart ( UInt uiHorOffset,       Int iUsedHeight )
+{
+  AOT( iUsedHeight > m_iHeight );   
+
+  m_iUsedHeight =       iUsedHeight; 
+  m_iHorOffset  = (Int) uiHorOffset;
+}
+#endif
+
+template <BlenMod iBM, Bool bBitInc> Void
+#if FIX_VSO_SETUP
+TRenSingleModelC<iBM,bBitInc>::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference )
+#else
 TRenSingleModelC<iBM,bBitInc>::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOff )
+#endif
 {
   AOT( !m_bUseOrgRef && pcOrgVideo );
@@ -239,7 +275,13 @@
   if ( pcOrgVideo && !bKeepReference )
   {
+#if FIX_VSO_SETUP
+    TRenFilter::copy(             pcOrgVideo->getLumaAddr() +  m_iHorOffset       * pcOrgVideo->getStride() , pcOrgVideo->getStride() , m_iWidth,      m_iUsedHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
+    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr()   + (m_iHorOffset >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
+    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr()   + (m_iHorOffset >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);    
+#else
     TRenFilter::copy(             pcOrgVideo->getLumaAddr() +  uiHorOff       * pcOrgVideo->getStride() , pcOrgVideo->getStride() , m_iWidth,      m_iHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
     TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr()   + (uiHorOff >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
     TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr()   + (uiHorOff >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);    
+#endif
     xSetStructRefView();
   }
@@ -248,5 +290,35 @@
   xResetStructError();
   xInitSampleStructs();
-
+#if FIX_VSO_SETUP
+  switch ( m_iMode )
+  {  
+  case 0:   
+#if LGE_VSO_EARLY_SKIP_A0093
+    xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false );
+#else
+    xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
+#endif   
+    break;
+  case 1:    
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
+#else
+    xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
+#endif
+    break;
+  case 2:
+    TRenFilter::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight );
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false);
+    xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
+#else      
+    xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
+    xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
+#endif
+    break;
+  default:
+    AOT(true);
+  }
+#else
   switch ( m_iMode )
   {  
@@ -278,4 +350,5 @@
     AOT(true);
   }
+#endif
 
   // Get Rendered View as Reference
@@ -340,5 +413,9 @@
 #endif  
 
+#if FIX_VSO_SETUP
+  for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ )
+#else
   for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+#endif
   {
     for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
@@ -393,5 +470,9 @@
 #endif
 
+#if FIX_VSO_SETUP
+  for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ )
+#else
   for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+#endif
   {
     for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
@@ -536,4 +617,36 @@
 }
 
+#if FIX_VSO_SETUP
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::getSynthVideo( Int iViewPos, TComPicYuv* pcPicYuv )
+{  
+  AOT( pcPicYuv->getWidth() != m_iWidth );
+  AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset );
+
+#if HHI_VSO_COLOR_PLANES
+  Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL };
+  xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]); 
+
+  // Temp image for chroma down sampling
+  PelImage cTempImage( m_iWidth, m_iUsedHeight, 3, 0);
+
+  Int  aiStrides[3]; 
+  Pel* apiData  [3]; 
+
+  cTempImage.getDataAndStrides( apiData, aiStrides ); 
+
+  for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ )
+  {
+    xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iUsedHeight);
+  }  
+  xCopy2PicYuv( apiData, aiStrides, pcPicYuv );
+#else
+  Pel RenModelOutPels::* piY;
+  xGetSampleStrTextPtrs(iViewPos, piY); 
+  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + m_iHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
+  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
+#endif  
+}
+#else
 template <BlenMod iBM, Bool bBitInc> Void
 TRenSingleModelC<iBM,bBitInc>::getSynthVideo( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset )
@@ -548,4 +661,5 @@
   // Temp image for chroma down sampling
   PelImage cTempImage( m_iWidth, m_iHeight, 3, 0);
+
   Int  aiStrides[3]; 
   Pel* apiData  [3]; 
@@ -557,5 +671,4 @@
     xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iHeight);
   }  
-
   xCopy2PicYuv( apiData, aiStrides, pcPicYuv, uiHorOffset );
 #else
@@ -566,11 +679,25 @@
 #endif  
 }
-
-
+#endif
+
+#if FIX_VSO_SETUP
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::getSynthDepth( Int iViewPos, TComPicYuv* pcPicYuv )
+{  
+  AOT( iViewPos != 0 && iViewPos != 1); 
+  AOT( pcPicYuv->getWidth()  != m_iWidth  );
+  AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset );
+
+  Pel RenModelOutPels::* piD = 0;
+  xGetSampleStrDepthPtrs(iViewPos, piD); 
+  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getLumaAddr() + pcPicYuv->getStride() * m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
+  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
+}
+
+#else
 template <BlenMod iBM, Bool bBitInc> Void
 TRenSingleModelC<iBM,bBitInc>::getSynthDepth( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOff )
 {  
   AOT( iViewPos != 0 && iViewPos != 1); 
-
   AOT( pcPicYuv->getWidth()  != m_iWidth  );
   AOT( pcPicYuv->getHeight() > m_iHeight + uiHorOff );
@@ -581,5 +708,39 @@
   pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
 }
-
+#endif
+
+#if FIX_VSO_SETUP
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv )
+{  
+  AOT( pcPicYuv->getWidth()  != m_iWidth  );
+  AOT( pcPicYuv->getHeight() <  m_iUsedHeight + m_iHorOffset);
+
+#if HHI_VSO_COLOR_PLANES
+  Pel RenModelOutPels::* piText[3];
+  piText[0] = &RenModelOutPels::iYRef;
+  piText[1] = &RenModelOutPels::iURef;
+  piText[2] = &RenModelOutPels::iVRef;
+
+  // Temp image for chroma down sampling
+
+  PelImage cTempImage( m_iWidth, m_iUsedHeight, 3, 0);
+  Int  aiStrides[3]; 
+  Pel* apiData  [3]; 
+
+  cTempImage.getDataAndStrides( apiData, aiStrides ); 
+
+  for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ )
+  {
+    xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iUsedHeight);
+  }  
+
+  xCopy2PicYuv( apiData, aiStrides, pcPicYuv );
+#else
+  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() *  pcPicYuv->getStride() + m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
+  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
+#endif  
+}
+#else
 template <BlenMod iBM, Bool bBitInc> Void
 TRenSingleModelC<iBM,bBitInc>::getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset )
@@ -595,4 +756,5 @@
 
   // Temp image for chroma down sampling
+
   PelImage cTempImage( m_iWidth, m_iHeight, 3, 0);
   Int  aiStrides[3]; 
@@ -604,5 +766,5 @@
   {
     xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iHeight);
-  }  
+  } 
 
   xCopy2PicYuv( apiData, aiStrides, pcPicYuv, uiHorOffset );
@@ -612,5 +774,5 @@
 #endif  
 }
-
+#endif
 
 template <BlenMod iBM, Bool bBitInc> RMDist
@@ -668,5 +830,4 @@
   // Get Data
   m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
-
   xSetViewRow      ( iStartPosY);
 
@@ -756,5 +917,5 @@
       {
           break;
-        }
+      }
 
       iCurPosX--;
@@ -802,8 +963,6 @@
   iEndChangePos = m_iStartChangePosX + iWidth - 1;
 
-
   for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
   {
-
 #ifdef LGE_VSO_EARLY_SKIP_A0093
     if( m_bEarlySkip && bFast )
@@ -1859,4 +2018,13 @@
 }
 
+#if FIX_VSO_SETUP
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget )
+{
+  TRenFilter::copy            ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getLumaAddr() +  m_iHorOffset       * rpcPicYuvTarget->getStride() , rpcPicYuvTarget->getStride () );
+  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getCbAddr  () + (m_iHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
+  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getCrAddr  () + (m_iHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
+}
+#else
 template <BlenMod iBM, Bool bBitInc> Void
 TRenSingleModelC<iBM,bBitInc>::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget, UInt uiHorOffset )
@@ -1866,4 +2034,5 @@
   TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iHeight, rpcPicYuvTarget->getCrAddr  () + (uiHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
 }
+#endif
 
 template class TRenSingleModelC<BLEND_NONE ,true>;
@@ -1943,3 +2112,2 @@
 }
 #endif
-
Index: /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.h
===================================================================
--- /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.h	(revision 192)
+++ /branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.h	(revision 193)
@@ -80,5 +80,10 @@
   // Set Frame dependent data
   virtual Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0;
+#if FIX_VSO_SETUP
+  virtual Void   setupPart ( UInt uiHorOffset,       Int iUsedHeight ) = 0;
+  virtual Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference ) = 0;
+#else
   virtual Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOffset ) = 0;
+#endif
 
   // Set Data
@@ -98,7 +103,13 @@
   virtual RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
 
+#if FIX_VSO_SETUP
+  virtual Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0;  
+  virtual Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0;
+  virtual Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0;
+#else
   virtual Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;  
   virtual Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;
   virtual Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;
+#endif
 };
 
@@ -170,5 +181,10 @@
   // Set Frame dependent data
   Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride );
+#if FIX_VSO_SETUP
+  Void   setupPart ( UInt uiHorOffset,       Int uiUsedHeight );
+  Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference );
+#else
   Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOffset );
+#endif
 
 #if LGE_VSO_EARLY_SKIP_A0093
@@ -187,7 +203,13 @@
   RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
 
+#if FIX_VSO_SETUP
+  Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv );  
+  Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv );
+  Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv );
+#else
   Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset );  
   Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  );
   Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  );
+#endif
 
 private:
@@ -198,5 +220,5 @@
   /////  Rendering /////
   // Left to Right
-#ifdef LGE_VSO_EARLY_SKIP_A0093
+#if LGE_VSO_EARLY_SKIP_A0093
                       __inline Bool   xDetectEarlySkipL   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
                       __inline Bool   xDetectEarlySkipR   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
@@ -234,5 +256,5 @@
   __inline Void   xGetBlendedValueBM2 ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV );
 #else
-  __inline Void   xGetBlendedValue    ( Pel iYL,   Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
+  __inline Void   xGetBlendedValue    ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
   __inline Void   xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
   __inline Void   xGetBlendedValueBM2 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
@@ -241,9 +263,9 @@
 
   // General
-  template<Bool bSet> __inline Void xSetShiftedPelL       (Int iSourcePos,                  Int iSubSourcePos, Int iTargetSPos,                   Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void xSetShiftedPelL       (Int iSourcePos,             Int iSubSourcePos, Int iTargetSPos,              Pel iFilled, RMDist& riError );
   template<Bool bSet> __inline Void xSetShiftedPelBlendL  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
   template<Bool bSet> __inline Void xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
 
-  template<Bool bSet> __inline Void xSetShiftedPelR       (Int iSourcePos,                  Int iSubSourcePos, Int iTargetSPos,                   Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void xSetShiftedPelR       (Int iSourcePos,             Int iSubSourcePos, Int iTargetSPos,              Pel iFilled, RMDist& riError );
   template<Bool bSet> __inline Void xSetShiftedPelBlendR  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
   template<Bool bSet> __inline Void xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
@@ -271,11 +293,19 @@
   Void            xInitSampleStructs           ();
   Void            xSetStructSynthViewAsRefView ();
+#if FIX_VSO_SETUP
+  Void            xCopy2PicYuv                ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget );
+#else
   Void            xCopy2PicYuv                ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget, UInt uiHorOffset );
-
+#endif
 
   template< typename S, typename T> 
   Void   xCopyFromSampleStruct ( S* ptSource , Int iSourceStride, T S::* ptSourceElement, T* ptTarget, Int iTargetStride, Int iWidth, Int iHeight )
   {
+#if FIX_VSO_SETUP
+    AOT( iWidth != m_iWidth ); 
+    for (Int iPosY = 0; iPosY < iHeight; iPosY++)
+#else
     for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
+#endif
     {
       for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
@@ -291,5 +321,10 @@
   Void   xCopyToSampleStruct ( T* ptSource , Int iSourceStride, S* ptTarget, Int iTargetStride, T S::* ptSourceElement, Int iWidth, Int iHeight )
   {
+#if FIX_VSO_SETUP
+    AOT( iWidth != m_iWidth ); 
+    for (Int iPosY = 0; iPosY < iHeight; iPosY++)
+#else
     for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
+#endif
     {
       for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
@@ -309,11 +344,18 @@
   Int   m_iStride;
   Int   m_iPad;
+#if FIX_VSO_SETUP
+  Int   m_iUsedHeight;
+  Int   m_iHorOffset; 
+#endif
 
   Int   m_iSampledWidth;
+#if FIX_VSO_SETUP
+#else
   Int   m_iSampledHeight;
+#endif
   Int   m_iSampledStride;
 
   RenModelInPels* m_pcInputSamples[2];
-  Int                  m_iInputSamplesStride;
+  Int             m_iInputSamplesStride;
 
   // Base
