Ticket #1219: patch_hm13.0_ticket_1219.txt

File patch_hm13.0_ticket_1219.txt, 1.8 KB (added by karlsharman, 10 years ago)
Line 
1Index: source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
2===================================================================
3--- source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  (revision hm13)
4+++ source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  (working copy)
5@@ -155,11 +155,13 @@
6   }
7 
8   //look-up table for clipping
9+  Int overallMaxSampleValue=0;
10   for(Int compIdx =0; compIdx < NUM_SAO_COMPONENTS; compIdx++)
11   {
12     Int bitDepthSample = (compIdx == SAO_Y)?g_bitDepthY:g_bitDepthC; //exclusive
13     Int maxSampleValue = (1<< bitDepthSample); //exclusive
14-    Int maxOffsetValue = (g_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
15+    Int maxOffsetValue = (g_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
16+    if (maxSampleValue>overallMaxSampleValue) overallMaxSampleValue=maxSampleValue;
17 
18     m_offsetClipTable[compIdx] = new Int[(maxSampleValue + maxOffsetValue -1)+ (maxOffsetValue)+1 ]; //positive & negative range plus 0
19     m_offsetClip[compIdx] = &(m_offsetClipTable[compIdx][maxOffsetValue]);
20@@ -175,20 +177,18 @@
21       *(offsetClipPtr + maxSampleValue+ k) = maxSampleValue-1;
22       *(offsetClipPtr -k -1 )              = 0;
23     }
24-    if(compIdx == SAO_Y) //g_bitDepthY is always larger than or equal to g_bitDepthC
25-    {
26-      m_signTable = new Short[ 2*(maxSampleValue-1) + 1 ];
27-      m_sign = &(m_signTable[maxSampleValue-1]);
28+  }
29 
30-      m_sign[0] = 0;
31-      for(Int k=1; k< maxSampleValue; k++)
32-      {
33-        m_sign[k] = 1;
34-        m_sign[-k]= -1;
35-      }
36-    }
37-  } 
38+  m_signTable = new Short[ 2*(overallMaxSampleValue-1) + 1 ];
39+  m_sign = &(m_signTable[overallMaxSampleValue-1]);
40 
41+  m_sign[0] = 0;
42+  for(Int k=1; k< overallMaxSampleValue; k++)
43+  {
44+    m_sign[k] = 1;
45+    m_sign[-k]= -1;
46+  }
47+
48 }
49 
50 Void TComSampleAdaptiveOffset::destroy()