Skip to content

Commit

Permalink
Merge branch 'mpd'
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed Nov 12, 2024
2 parents 675048a + 8bb7300 commit d2898f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion MMVII/include/MMVII_nums.h
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@ class cCelCC : public cMemCheck
public :
std::vector<size_t> mEquivCode; /// all codes equivalent
size_t mLowCode; ///< lower representant
bool mTmp; /// some marker to use when convenient
bool mTmp; ///< some marker to use when convenient
int mNum; ///< Num used so that names is alway the same whatever maybe the selection

size_t HammingDist(const cCelCC &) const;

Expand Down Expand Up @@ -930,6 +931,7 @@ class cCompEquiCodes : public cMemCheck
const std::vector<cCelCC*> & VecOfCells() const; ///< Accessor
const cCelCC & CellOfCodeOK(size_t aCode) const; ///< Error if null
const cCelCC * CellOfCode(size_t) const; ///< nullptr if bad range or no cell
cCelCC * CellOfCode(size_t) ; ///< nullptr if bad range or no cell

~cCompEquiCodes();
static void Bench(size_t aNBB,size_t aPer,bool Miror);
Expand Down
6 changes: 5 additions & 1 deletion MMVII/src/CodedTarget/cGenerateEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ int cAppliGenerateEncoding::Exe()

for (size_t aK=0 ; aK<aVCode.size(); aK++)
{
const cCelCC * aCel = mCEC->CellOfCode(aVCode[aK].y());
cCelCC * aCel = mCEC->CellOfCode(aVCode[aK].y());
aCel->mNum = aVCode[aK].x();
MMVII_INTERNAL_ASSERT_bench(aCel!=0,"CellOfCode in3D AICON");
MMVII_INTERNAL_ASSERT_bench(aVCode[aK].y()==(int)aCel->mLowCode,"CellOfCode in3D AICON");
}
Expand Down Expand Up @@ -539,6 +540,9 @@ int cAppliGenerateEncoding::Exe()
for (size_t aK1=0 ; aK1<mVOC.size(); aK1++)
{
size_t aNum = aK1 + Num000;
// StdOut() << "NNNNNnnN= " << aNum << " " << mVOC[aK1]->mNum << "\n";
MMVII_INTERNAL_ASSERT_strong(mVOC[aK1]->mNum>=0,"Num was not correctly set in cCelCC");
aNum = mVOC[aK1]->mNum;
size_t aCode = mVOC[aK1]->mLowCode;
aBE.AddOneEncoding(aNum,aCode); // add a new encoding

Expand Down
12 changes: 9 additions & 3 deletions MMVII/src/UtiMaths/bitcoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ size_t MaxRun2Length(tU_INT4 aVal,size_t aPow2)
/* *************************** */

cCelCC::cCelCC(size_t aLowestCode) :
mLowCode (aLowestCode)
mLowCode (aLowestCode),
mNum (-1)
{
}

Expand Down Expand Up @@ -257,7 +258,7 @@ size_t cCelCC::HammingDist(const cCelCC & aC2) const
cCompEquiCodes::cCompEquiCodes(size_t aNbBits,size_t aPer,bool WithMirror) :
mNbBits (aNbBits),
mPeriod (aPer),
mNbCodeUC (size_t(1)<<mNbBits),
mNbCodeUC (size_t(1)<<mNbBits),
mVCodes2Cell (mNbCodeUC,nullptr)
{
MMVII_INTERNAL_ASSERT_strong((aNbBits%aPer)==0,"NbBit not multiple of period in cCompEquiCodes");
Expand All @@ -266,6 +267,7 @@ cCompEquiCodes::cCompEquiCodes(size_t aNbBits,size_t aPer,bool WithMirror) :
if (mVCodes2Cell[aCode] == nullptr)
{
cCelCC * aNewCel = new cCelCC(aCode);
aNewCel->mNum = mVecOfCells.size();
mVecOfCells.push_back(aNewCel);

AddCodeWithPermCirc(aCode,aNewCel);
Expand Down Expand Up @@ -314,10 +316,14 @@ const cCelCC & cCompEquiCodes::CellOfCodeOK(size_t aCode) const
const cCelCC * cCompEquiCodes::CellOfCode(size_t aCode) const
{
if (aCode>=mVCodes2Cell.size()) return nullptr;

return mVCodes2Cell.at(aCode);
}

cCelCC * cCompEquiCodes::CellOfCode(size_t aCode)
{
if (aCode>=mVCodes2Cell.size()) return nullptr;
return mVCodes2Cell.at(aCode);
}


void cCompEquiCodes::AddCodeWithPermCirc(size_t aCode,cCelCC * aNewCel)
Expand Down

0 comments on commit d2898f1

Please sign in to comment.