fixed bug in SearchCues
Change-Id: I8a6e413820ce2da7f7975825aaa056c407dcc043
This commit is contained in:
@@ -2249,45 +2249,38 @@ bool Segment::SearchCues(
|
|||||||
|
|
||||||
Cluster** const jj = ii + m_clusterCount;
|
Cluster** const jj = ii + m_clusterCount;
|
||||||
Cluster** j = jj;
|
Cluster** j = jj;
|
||||||
|
assert(j > i);
|
||||||
|
|
||||||
while (i < j)
|
for (;;)
|
||||||
{
|
{
|
||||||
//INVARIANT:
|
//INVARIANT:
|
||||||
//[0, i) <= pTP->m_pos
|
//[0, i) < pTP->m_pos
|
||||||
//[i, j) ?
|
//[i, j) ?
|
||||||
//[j, jj) > pTP->m_pos
|
//[j, jj) > pTP->m_pos
|
||||||
|
|
||||||
Cluster** const k = i + (j - i) / 2;
|
Cluster** const k = i + (j - i) / 2;
|
||||||
assert(k < jj);
|
assert(k < jj);
|
||||||
|
|
||||||
Cluster* const pCluster = *k;
|
pCluster = *k;
|
||||||
assert(pCluster);
|
assert(pCluster);
|
||||||
|
|
||||||
const long long t = pCluster->GetTime();
|
const long long pos = _abs64(pCluster->m_pos);
|
||||||
|
assert(pos);
|
||||||
|
|
||||||
if (t <= _abs64(pCluster->m_pos))
|
if (pos < pTP->m_pos)
|
||||||
i = k + 1;
|
i = k + 1;
|
||||||
else
|
else if (pos > pTP->m_pos)
|
||||||
j = k;
|
j = k;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pBlockEntry = pCluster->GetEntry(*pCP, *pTP);
|
||||||
|
assert(pBlockEntry);
|
||||||
|
|
||||||
assert(i <= j);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(i < j);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(i == j);
|
|
||||||
assert(i > ii);
|
|
||||||
assert(i <= jj);
|
|
||||||
|
|
||||||
Cluster** const k = i - 1;
|
|
||||||
|
|
||||||
pCluster = *k;
|
|
||||||
assert(pCluster);
|
|
||||||
assert(pCluster->m_pos);
|
|
||||||
assert(_abs64(pCluster->m_pos) == pTP->m_pos);
|
|
||||||
|
|
||||||
pBlockEntry = pCluster->GetEntry(*pCP, *pTP);
|
|
||||||
assert(pBlockEntry);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user