[x265] replace char to int8_t, where it should be signed char
Satoshi Nakagawa
nakagawa424 at oki.com
Thu Nov 20 03:32:18 CET 2014
# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1416450633 -32400
# Thu Nov 20 11:30:33 2014 +0900
# Node ID 46ae5bd20c8c317b8f71fbce0d7ad6bd6b8bba21
# Parent d059cfa88f1ac79b319bd8a05bc70704d454f0ba
replace char to int8_t, where it should be signed char
diff -r d059cfa88f1a -r 46ae5bd20c8c source/common/cudata.cpp
--- a/source/common/cudata.cpp Tue Nov 18 14:11:12 2014 -0600
+++ b/source/common/cudata.cpp Thu Nov 20 11:30:33 2014 +0900
@@ -227,12 +227,12 @@
/* Each CU's data is layed out sequentially within the charMemBlock */
uint8_t *charBuf = dataPool.charMemBlock + (m_numPartitions * BytesPerPartition) * instance;
- m_qp = (char*)charBuf; charBuf += m_numPartitions;
+ m_qp = (int8_t*)charBuf; charBuf += m_numPartitions;
m_log2CUSize = charBuf; charBuf += m_numPartitions;
m_lumaIntraDir = charBuf; charBuf += m_numPartitions;
m_tqBypass = charBuf; charBuf += m_numPartitions;
- m_refIdx[0] = (char*)charBuf; charBuf += m_numPartitions;
- m_refIdx[1] = (char*)charBuf; charBuf += m_numPartitions;
+ m_refIdx[0] = (int8_t*)charBuf; charBuf += m_numPartitions;
+ m_refIdx[1] = (int8_t*)charBuf; charBuf += m_numPartitions;
m_cuDepth = charBuf; charBuf += m_numPartitions;
m_predMode = charBuf; charBuf += m_numPartitions; /* the order up to here is important in initCTU() and initSubCU() */
m_partSize = charBuf; charBuf += m_numPartitions;
@@ -772,7 +772,7 @@
}
/* Get reference QP from left QpMinCu or latest coded QP */
-char CUData::getRefQP(uint32_t curAbsIdxInCTU) const
+int8_t CUData::getRefQP(uint32_t curAbsIdxInCTU) const
{
uint32_t lPartIdx = 0, aPartIdx = 0;
const CUData* cULeft = getQpMinCuLeft(lPartIdx, m_absIdxInCTU + curAbsIdxInCTU);
@@ -794,7 +794,7 @@
return lastValidPartIdx;
}
-char CUData::getLastCodedQP(uint32_t absPartIdx) const
+int8_t CUData::getLastCodedQP(uint32_t absPartIdx) const
{
uint32_t quPartIdxMask = 0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2;
int lastValidPartIdx = getLastValidPartIdx(absPartIdx & quPartIdxMask);
@@ -808,7 +808,7 @@
else if (m_cuAddr > 0 && !(m_slice->m_pps->bEntropyCodingSyncEnabled && !(m_cuAddr % m_slice->m_sps->numCuInWidth)))
return m_encData->getPicCTU(m_cuAddr - 1)->getLastCodedQP(NUM_CU_PARTITIONS);
else
- return (char)m_slice->m_sliceQp;
+ return (int8_t)m_slice->m_sliceQp;
}
}
@@ -936,7 +936,7 @@
return ctx;
}
-bool CUData::setQPSubCUs(char qp, uint32_t absPartIdx, uint32_t depth)
+bool CUData::setQPSubCUs(int8_t qp, uint32_t absPartIdx, uint32_t depth)
{
uint32_t curPartNumb = NUM_CU_PARTITIONS >> (depth << 1);
uint32_t curPartNumQ = curPartNumb >> 2;
@@ -1211,7 +1211,7 @@
setAllPU(m_mv[list], mv, absPartIdx, puIdx);
}
-void CUData::setPURefIdx(int list, char refIdx, int absPartIdx, int puIdx)
+void CUData::setPURefIdx(int list, int8_t refIdx, int absPartIdx, int puIdx)
{
setAllPU(m_refIdx[list], refIdx, absPartIdx, puIdx);
}
diff -r d059cfa88f1a -r 46ae5bd20c8c source/common/cudata.h
--- a/source/common/cudata.h Tue Nov 18 14:11:12 2014 -0600
+++ b/source/common/cudata.h Thu Nov 20 11:30:33 2014 +0900
@@ -127,11 +127,11 @@
int m_vChromaShift;
/* Per-part data, stored contiguously */
- char* m_qp; // array of QP values
+ int8_t* m_qp; // array of QP values
uint8_t* m_log2CUSize; // array of cu log2Size TODO: seems redundant to depth
uint8_t* m_lumaIntraDir; // array of intra directions (luma)
uint8_t* m_tqBypass; // array of CU lossless flags
- char* m_refIdx[2]; // array of motion reference indices per list
+ int8_t* m_refIdx[2]; // array of motion reference indices per list
uint8_t* m_cuDepth; // array of depths
uint8_t* m_predMode; // array of prediction modes
uint8_t* m_partSize; // array of partition sizes
@@ -177,7 +177,7 @@
void clearCbf() { m_partSet(m_cbf[0], 0); m_partSet(m_cbf[1], 0); m_partSet(m_cbf[2], 0); }
/* these functions all take depth as an absolute depth from CTU, it is used to calculate the number of parts to copy */
- void setQPSubParts(char qp, uint32_t absPartIdx, uint32_t depth) { s_partSet[depth]((uint8_t*)m_qp + absPartIdx, (uint8_t)qp); }
+ void setQPSubParts(int8_t qp, uint32_t absPartIdx, uint32_t depth) { s_partSet[depth]((uint8_t*)m_qp + absPartIdx, (uint8_t)qp); }
void setTUDepthSubParts(uint8_t tuDepth, uint32_t absPartIdx, uint32_t depth) { s_partSet[depth](m_tuDepth + absPartIdx, tuDepth); }
void setLumaIntraDirSubParts(uint8_t dir, uint32_t absPartIdx, uint32_t depth) { s_partSet[depth](m_lumaIntraDir + absPartIdx, dir); }
void setChromIntraDirSubParts(uint8_t dir, uint32_t absPartIdx, uint32_t depth) { s_partSet[depth](m_chromaIntraDir + absPartIdx, dir); }
@@ -186,15 +186,15 @@
void setTransformSkipSubParts(uint8_t tskip, TextType ttype, uint32_t absPartIdx, uint32_t depth) { s_partSet[depth](m_transformSkip[ttype] + absPartIdx, tskip); }
void setTransformSkipPartRange(uint8_t tskip, TextType ttype, uint32_t absPartIdx, uint32_t coveredPartIdxes) { memset(m_transformSkip[ttype] + absPartIdx, tskip, coveredPartIdxes); }
- bool setQPSubCUs(char qp, uint32_t absPartIdx, uint32_t depth);
+ bool setQPSubCUs(int8_t qp, uint32_t absPartIdx, uint32_t depth);
void setPUInterDir(uint8_t dir, uint32_t absPartIdx, uint32_t puIdx);
void setPUMv(int list, const MV& mv, int absPartIdx, int puIdx);
- void setPURefIdx(int list, char refIdx, int absPartIdx, int puIdx);
+ void setPURefIdx(int list, int8_t refIdx, int absPartIdx, int puIdx);
uint8_t getCbf(uint32_t absPartIdx, TextType ttype, uint32_t trDepth) const { return (m_cbf[ttype][absPartIdx] >> trDepth) & 0x1; }
uint8_t getQtRootCbf(uint32_t absPartIdx) const { return m_cbf[0][absPartIdx] || m_cbf[1][absPartIdx] || m_cbf[2][absPartIdx]; }
- char getRefQP(uint32_t currAbsIdxInCTU) const;
+ int8_t getRefQP(uint32_t currAbsIdxInCTU) const;
uint32_t getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, MVField (*mvFieldNeighbours)[2], uint8_t* interDirNeighbours) const;
void clipMv(MV& outMV) const;
int fillMvpCand(uint32_t puIdx, uint32_t absPartIdx, int picList, int refIdx, MV* amvpCand, MV* mvc) const;
@@ -237,7 +237,7 @@
template<typename T>
void setAllPU(T *p, const T& val, int absPartIdx, int puIdx);
- char getLastCodedQP(uint32_t absPartIdx) const;
+ int8_t getLastCodedQP(uint32_t absPartIdx) const;
int getLastValidPartIdx(int absPartIdx) const;
bool hasEqualMotion(uint32_t absPartIdx, const CUData& candCU, uint32_t candAbsPartIdx) const;
diff -r d059cfa88f1a -r 46ae5bd20c8c source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Tue Nov 18 14:11:12 2014 -0600
+++ b/source/encoder/analysis.cpp Thu Nov 20 11:30:33 2014 +0900
@@ -1229,9 +1229,9 @@
tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i; // merge candidate ID is stored in L0 MVP idx
tempPred->cu.m_interDir[0] = interDirNeighbours[i];
tempPred->cu.m_mv[0][0] = mvFieldNeighbours[i][0].mv;
- tempPred->cu.m_refIdx[0][0] = (char)mvFieldNeighbours[i][0].refIdx;
+ tempPred->cu.m_refIdx[0][0] = (int8_t)mvFieldNeighbours[i][0].refIdx;
tempPred->cu.m_mv[1][0] = mvFieldNeighbours[i][1].mv;
- tempPred->cu.m_refIdx[1][0] = (char)mvFieldNeighbours[i][1].refIdx;
+ tempPred->cu.m_refIdx[1][0] = (int8_t)mvFieldNeighbours[i][1].refIdx;
// do MC only for Luma part
prepMotionCompensation(tempPred->cu, cuGeom, 0);
@@ -1267,9 +1267,9 @@
tempPred->cu.m_mvpIdx[0][0] = (uint8_t)bestSadCand;
tempPred->cu.setPUInterDir(interDirNeighbours[bestSadCand], 0, 0);
tempPred->cu.setPUMv(0, mvFieldNeighbours[bestSadCand][0].mv, 0, 0);
- tempPred->cu.setPURefIdx(0, (char)mvFieldNeighbours[bestSadCand][0].refIdx, 0, 0);
+ tempPred->cu.setPURefIdx(0, (int8_t)mvFieldNeighbours[bestSadCand][0].refIdx, 0, 0);
tempPred->cu.setPUMv(1, mvFieldNeighbours[bestSadCand][1].mv, 0, 0);
- tempPred->cu.setPURefIdx(1, (char)mvFieldNeighbours[bestSadCand][1].refIdx, 0, 0);
+ tempPred->cu.setPURefIdx(1, (int8_t)mvFieldNeighbours[bestSadCand][1].refIdx, 0, 0);
tempPred->sa8dCost = bestPred->sa8dCost;
tempPred->predYuv.copyFromYuv(bestPred->predYuv);
@@ -1283,9 +1283,9 @@
/* broadcast sets of MV field data */
bestPred->cu.setPUInterDir(interDirNeighbours[bestSadCand], 0, 0);
bestPred->cu.setPUMv(0, mvFieldNeighbours[bestSadCand][0].mv, 0, 0);
- bestPred->cu.setPURefIdx(0, (char)mvFieldNeighbours[bestSadCand][0].refIdx, 0, 0);
+ bestPred->cu.setPURefIdx(0, (int8_t)mvFieldNeighbours[bestSadCand][0].refIdx, 0, 0);
bestPred->cu.setPUMv(1, mvFieldNeighbours[bestSadCand][1].mv, 0, 0);
- bestPred->cu.setPURefIdx(1, (char)mvFieldNeighbours[bestSadCand][1].refIdx, 0, 0);
+ bestPred->cu.setPURefIdx(1, (int8_t)mvFieldNeighbours[bestSadCand][1].refIdx, 0, 0);
}
/* sets md.bestMode if a valid merge candidate is found, else leaves it NULL */
@@ -1339,9 +1339,9 @@
tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i; /* merge candidate ID is stored in L0 MVP idx */
tempPred->cu.m_interDir[0] = interDirNeighbours[i];
tempPred->cu.m_mv[0][0] = mvFieldNeighbours[i][0].mv;
- tempPred->cu.m_refIdx[0][0] = (char)mvFieldNeighbours[i][0].refIdx;
+ tempPred->cu.m_refIdx[0][0] = (int8_t)mvFieldNeighbours[i][0].refIdx;
tempPred->cu.m_mv[1][0] = mvFieldNeighbours[i][1].mv;
- tempPred->cu.m_refIdx[1][0] = (char)mvFieldNeighbours[i][1].refIdx;
+ tempPred->cu.m_refIdx[1][0] = (int8_t)mvFieldNeighbours[i][1].refIdx;
tempPred->cu.setPredModeSubParts(MODE_INTER); /* must be cleared between encode iterations */
prepMotionCompensation(tempPred->cu, cuGeom, 0);
@@ -1372,9 +1372,9 @@
tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i;
tempPred->cu.m_interDir[0] = interDirNeighbours[i];
tempPred->cu.m_mv[0][0] = mvFieldNeighbours[i][0].mv;
- tempPred->cu.m_refIdx[0][0] = (char)mvFieldNeighbours[i][0].refIdx;
+ tempPred->cu.m_refIdx[0][0] = (int8_t)mvFieldNeighbours[i][0].refIdx;
tempPred->cu.m_mv[1][0] = mvFieldNeighbours[i][1].mv;
- tempPred->cu.m_refIdx[1][0] = (char)mvFieldNeighbours[i][1].refIdx;
+ tempPred->cu.m_refIdx[1][0] = (int8_t)mvFieldNeighbours[i][1].refIdx;
tempPred->cu.setPredModeSubParts(MODE_INTER);
tempPred->predYuv.copyFromYuv(bestPred->predYuv);
}
@@ -1394,9 +1394,9 @@
uint32_t bestCand = bestPred->cu.m_mvpIdx[0][0];
bestPred->cu.setPUInterDir(interDirNeighbours[bestCand], 0, 0);
bestPred->cu.setPUMv(0, mvFieldNeighbours[bestCand][0].mv, 0, 0);
- bestPred->cu.setPURefIdx(0, (char)mvFieldNeighbours[bestCand][0].refIdx, 0, 0);
+ bestPred->cu.setPURefIdx(0, (int8_t)mvFieldNeighbours[bestCand][0].refIdx, 0, 0);
bestPred->cu.setPUMv(1, mvFieldNeighbours[bestCand][1].mv, 0, 0);
- bestPred->cu.setPURefIdx(1, (char)mvFieldNeighbours[bestCand][1].refIdx, 0, 0);
+ bestPred->cu.setPURefIdx(1, (int8_t)mvFieldNeighbours[bestCand][1].refIdx, 0, 0);
}
}
@@ -1519,8 +1519,8 @@
cu.setPartSizeSubParts(SIZE_2Nx2N);
cu.setPredModeSubParts(MODE_INTER);
cu.setPUInterDir(3, 0, 0);
- cu.setPURefIdx(0, (char)ref0, 0, 0);
- cu.setPURefIdx(1, (char)ref1, 0, 0);
+ cu.setPURefIdx(0, (int8_t)ref0, 0, 0);
+ cu.setPURefIdx(1, (int8_t)ref1, 0, 0);
cu.m_mvpIdx[0][0] = (uint8_t)mvpIdx0;
cu.m_mvpIdx[1][0] = (uint8_t)mvpIdx1;
cu.m_mergeFlag[0] = 0;
diff -r d059cfa88f1a -r 46ae5bd20c8c source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Tue Nov 18 14:11:12 2014 -0600
+++ b/source/encoder/frameencoder.cpp Thu Nov 20 11:30:33 2014 +0900
@@ -759,7 +759,7 @@
int qp = calcQpForCu(cuAddr, curEncData.m_cuStat[cuAddr].baseQp);
tld.analysis.setQP(*slice, qp);
qp = Clip3(QP_MIN, QP_MAX_SPEC, qp);
- ctu->setQPSubParts((char)qp, 0, 0);
+ ctu->setQPSubParts((int8_t)qp, 0, 0);
curEncData.m_rowStat[row].sumQpAq += qp;
}
else
diff -r d059cfa88f1a -r 46ae5bd20c8c source/encoder/search.cpp
--- a/source/encoder/search.cpp Tue Nov 18 14:11:12 2014 -0600
+++ b/source/encoder/search.cpp Thu Nov 20 11:30:33 2014 +0900
@@ -1834,9 +1834,9 @@
continue;
cu.m_mv[0][m.absPartIdx] = m.mvFieldNeighbours[mergeCand][0].mv;
- cu.m_refIdx[0][m.absPartIdx] = (char)m.mvFieldNeighbours[mergeCand][0].refIdx;
+ cu.m_refIdx[0][m.absPartIdx] = (int8_t)m.mvFieldNeighbours[mergeCand][0].refIdx;
cu.m_mv[1][m.absPartIdx] = m.mvFieldNeighbours[mergeCand][1].mv;
- cu.m_refIdx[1][m.absPartIdx] = (char)m.mvFieldNeighbours[mergeCand][1].refIdx;
+ cu.m_refIdx[1][m.absPartIdx] = (int8_t)m.mvFieldNeighbours[mergeCand][1].refIdx;
prepMotionCompensation(cu, cuGeom, puIdx);
motionCompensation(tempYuv, true, false);
More information about the x265-devel
mailing list