<div dir="ltr">This patch has been pushed to the master branch. <br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><b>__________________________</b></div><div><b>Karam Singh</b></div><div><b>Ph.D. IIT Guwahati</b></div><div><font size="1">Senior Software (Video Coding) Engineer </font></div><div><font size="1">Mobile: +91 8011279030</font></div><div><font size="1">Block 9A, 6th floor, DLF Cyber City</font></div><div><font size="1">Manapakkam, Chennai 600 089</font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2024 at 5:32 PM Anusuya Kumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com">anusuya.kumarasamy@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From bac40495e1159c4d857105318021fb75faadac0b Mon Sep 17 00:00:00 2001<br>From: AnusuyaKumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com" target="_blank">anusuya.kumarasamy@multicorewareinc.com</a>><br>Date: Mon, 30 Sep 2024 11:01:08 +0530<br>Subject: [PATCH] Fix build warnings for MV-HEVC, Alpha & SCC and Code cleanup<br><br>---<br> source/abrEncApp.cpp | 18 ++++----<br> source/abrEncApp.h | 2 +-<br> source/common/cudata.cpp | 11 ++++-<br> source/common/cudata.h | 10 ++++-<br> source/common/lowpassdct.cpp | 6 ++-<br> source/common/param.cpp | 53 +++++++++++++++++++++++-<br> source/common/slice.cpp | 10 +++--<br> source/common/slice.h | 4 +-<br> source/encoder/analysis.cpp | 16 +++++++-<br> source/encoder/analysis.h | 7 +++-<br> source/encoder/dpb.cpp | 8 +++-<br> source/encoder/encoder.cpp | 28 +++++++------<br> source/encoder/entropy.cpp | 10 +++--<br> source/encoder/entropy.h | 4 ++<br> source/encoder/frameencoder.cpp | 7 ++--<br> source/encoder/level.cpp | 45 --------------------<br> source/encoder/nal.cpp | 2 +-<br> source/encoder/search.cpp | 32 ++++++++++-----<br> source/encoder/search.h | 5 ++-<br> source/encoder/sei.h | 73 ++++++++++++++++++++++++++-------<br> source/x265.h | 7 ++--<br> source/x265cli.cpp | 3 +-<br> 22 files changed, 240 insertions(+), 121 deletions(-)<br><br>diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp<br>index c5dcf3559..4c433122b 100644<br>--- a/source/abrEncApp.cpp<br>+++ b/source/abrEncApp.cpp<br>@@ -63,7 +63,7 @@ namespace X265_NS {<br> m_passEnc[i]->init(ret);<br> }<br> <br>- m_numInputViews = m_passEnc[0]->m_param->numViews;<br>+ m_numInputViews = m_passEnc[0]->m_param->numViews - !!m_passEnc[0]->m_param->format;<br> if (!allocBuffers())<br> {<br> x265_log(NULL, X265_LOG_ERROR, "Unable to allocate memory for buffers\n");<br>@@ -207,7 +207,7 @@ namespace X265_NS {<br> m_parent = parent;<br> if (!(m_cliopt.enableScaler && m_id))<br> {<br>- for (int view = 0; view < m_cliopt.param->numViews; view++)<br>+ for (int view = 0; view < m_cliopt.param->numViews - !!m_cliopt.param->format; view++)<br> m_input[view] = m_cliopt.input[view];<br> }<br> m_param = cliopt.param;<br>@@ -592,14 +592,14 @@ ret:<br> <br> x265_picture pic_orig[MAX_VIEWS];<br> x265_picture *pic_in[MAX_VIEWS];<br>- for (int view = 0; view < m_param->numViews; view++)<br>+ for (int view = 0; view < m_param->numViews - !!m_param->format; view++)<br> pic_in[view] = &pic_orig[view];<br> /* Allocate recon picture if analysis save/load is enabled */<br> std::priority_queue<int64_t>* pts_queue = m_cliopt.output->needPTS() ? new std::priority_queue<int64_t>() : NULL;<br> x265_picture* pic_recon;<br> x265_picture pic_out[MAX_LAYERS];<br> <br>- pic_recon = (m_cliopt.recon || m_param->analysisSave || m_param->analysisLoad || pts_queue || reconPlay || m_param->csvLogLevel) ? pic_out : NULL;<br>+ pic_recon = (m_cliopt.recon[0] || m_param->analysisSave || m_param->analysisLoad || pts_queue || reconPlay || m_param->csvLogLevel) ? pic_out : NULL;<br> uint32_t inFrameCount = 0;<br> uint32_t outFrameCount = 0;<br> x265_nal *p_nal;<br>@@ -625,7 +625,7 @@ ret:<br> m_cliopt.totalbytes += m_cliopt.output->writeHeaders(p_nal, nal);<br> }<br> <br>- for (int view = 0; view < m_param->numViews; view++)<br>+ for (int view = 0; view < m_param->numViews - !!m_param->format; view++)<br> {<br> if (m_param->bField && m_param->interlaceMode)<br> {<br>@@ -639,7 +639,7 @@ ret:<br> api->picture_init(m_param, &pic_orig[view]);<br> }<br> <br>- if (m_param->dolbyProfile && m_cliopt.dolbyVisionRpu)<br>+ if (m_param->dolbyProfile && m_cliopt.dolbyVisionRpu && pic_in[0])<br> {<br> rpuPayload = X265_MALLOC(uint8_t, 1024);<br> pic_in[0]->rpu.payload = rpuPayload;<br>@@ -659,7 +659,7 @@ ret:<br> // main encoder loop<br> while (pic_in[0] && !b_ctrl_c)<br> {<br>- for (int view = 0; view < m_param->numViews; view++)<br>+ for (int view = 0; view < m_param->numViews - !!m_param->format; view++)<br> {<br> pic_orig[view].poc = (m_param->bField && m_param->interlaceMode) ? inFrameCount * 2 : inFrameCount;<br> if (m_cliopt.qpfile)<br>@@ -676,7 +676,7 @@ ret:<br> if (m_cliopt.framesToBeEncoded && inFrameCount >= m_cliopt.framesToBeEncoded)<br> pic_in[view] = NULL;<br> else if (readPicture(pic_in[view], view)){<br>- if(view == m_param->numViews - 1)<br>+ if(view == m_param->numViews - !!m_param->format - 1)<br> inFrameCount++;<br> }<br> else<br>@@ -785,7 +785,7 @@ ret:<br> {<br> x265_picture* picInput = NULL;<br> if (inputPicNum == 2)<br>- picInput = pic_in ? (inputNum ? &picField2 : &picField1) : NULL;<br>+ picInput = *pic_in ? (inputNum ? &picField2 : &picField1) : NULL;<br> else<br> picInput = *pic_in;<br> <br>diff --git a/source/abrEncApp.h b/source/abrEncApp.h<br>index fab694656..7c1142baf 100644<br>--- a/source/abrEncApp.h<br>+++ b/source/abrEncApp.h<br>@@ -42,7 +42,7 @@ namespace X265_NS {<br> {<br> public:<br> uint8_t m_numEncodes;<br>- uint8_t m_numInputViews; // Number of inputs for multiview-extension<br>+ int m_numInputViews; // Number of inputs for multiview-extension<br> PassEncoder **m_passEnc;<br> uint32_t m_queueSize;<br> ThreadSafeInteger m_numActiveEncodes;<br>diff --git a/source/common/cudata.cpp b/source/common/cudata.cpp<br>index ae1fb4694..6ea6048b7 100644<br>--- a/source/common/cudata.cpp<br>+++ b/source/common/cudata.cpp<br>@@ -327,7 +327,11 @@ void CUData::initCTU(const Frame& frame, uint32_t cuAddr, int qp, uint32_t first<br> }<br> <br> // initialize Sub partition<br>+#if ENABLE_SCC_EXT<br> void CUData::initSubCU(const CUData& ctu, const CUGeom& cuGeom, int qp, MV lastIntraBCMv[2])<br>+#else<br>+void CUData::initSubCU(const CUData& ctu, const CUGeom& cuGeom, int qp)<br>+#endif<br> {<br> m_absIdxInCTU = cuGeom.absPartIdx;<br> m_encData = ctu.m_encData;<br>@@ -1737,7 +1741,11 @@ uint32_t CUData::getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, MV<br> }<br> <br> // Create the PMV list. Called for each reference index.<br>+#if (ENABLE_MULTIVIEW || ENABLE_SCC_EXT)<br> int CUData::getPMV(InterNeighbourMV* neighbours, uint32_t picList, uint32_t refIdx, MV* amvpCand, MV* pmv, uint32_t puIdx, uint32_t absPartIdx) const<br>+#else<br>+int CUData::getPMV(InterNeighbourMV* neighbours, uint32_t picList, uint32_t refIdx, MV* amvpCand, MV* pmv) const<br>+#endif<br> {<br> MV directMV[MD_ABOVE_LEFT + 1];<br> MV indirectMV[MD_ABOVE_LEFT + 1];<br>@@ -1847,7 +1855,6 @@ int CUData::getPMV(InterNeighbourMV* neighbours, uint32_t picList, uint32_t refI<br> int refId = refIdx;<br> uint32_t absPartAddr = m_absIdxInCTU + absPartIdx;<br> uint32_t partIdxRB = deriveRightBottomIdx(puIdx);<br>- bool isValid;<br> <br> // co-located RightBottom temporal predictor (H)<br> int ctuIdx = -1;<br>@@ -2128,7 +2135,7 @@ bool CUData::getColMVP(MV& outMV, int& outRefIdx, int picList, int cuAddr, int p<br> outMV = scaleMvByPOCDist(colmv, curPOC, curRefPOC, colPOC, colRefPOC);<br> #else<br> outMV = scaleMvByPOCDist(colmv, curPOC, curRefPOC, colPOC, colRefPOC);<br>-#endif;<br>+#endif<br> return true;<br> }<br> <br>diff --git a/source/common/cudata.h b/source/common/cudata.h<br>index 2b669a802..7c25a4e07 100644<br>--- a/source/common/cudata.h<br>+++ b/source/common/cudata.h<br>@@ -253,7 +253,9 @@ public:<br> static void calcCTUGeoms(uint32_t ctuWidth, uint32_t ctuHeight, uint32_t maxCUSize, uint32_t minCUSize, CUGeom cuDataArray[CUGeom::MAX_GEOMS]);<br> <br> void initCTU(const Frame& frame, uint32_t cuAddr, int qp, uint32_t firstRowInSlice, uint32_t lastRowInSlice, uint32_t lastCUInSlice);<br>- void initSubCU(const CUData& ctu, const CUGeom& cuGeom, int qp, MV lastIntraBCMv[2] = 0);<br>+#if !ENABLE_SCC_EXT<br>+ void initSubCU(const CUData& ctu, const CUGeom& cuGeom, int qp);<br>+#endif<br> void initLosslessCU(const CUData& cu, const CUGeom& cuGeom);<br> <br> void copyPartFrom(const CUData& cu, const CUGeom& childGeom, uint32_t subPartIdx);<br>@@ -289,7 +291,11 @@ public:<br> int8_t getRefQP(uint32_t currAbsIdxInCTU) const;<br> uint32_t getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, MVField (*candMvField)[2], uint8_t* candDir) const;<br> void clipMv(MV& outMV) const;<br>+#if (ENABLE_MULTIVIEW || ENABLE_SCC_EXT)<br> int getPMV(InterNeighbourMV* neighbours, uint32_t reference_list, uint32_t refIdx, MV* amvpCand, MV* pmv, uint32_t puIdx = 0, uint32_t absPartIdx = 0) const;<br>+#else<br>+ int getPMV(InterNeighbourMV* neighbours, uint32_t reference_list, uint32_t refIdx, MV* amvpCand, MV* pmv) const;<br>+#endif<br> void getNeighbourMV(uint32_t puIdx, uint32_t absPartIdx, InterNeighbourMV* neighbours) const;<br> void getIntraTUQtDepthRange(uint32_t tuDepthRange[2], uint32_t absPartIdx) const;<br> void getInterTUQtDepthRange(uint32_t tuDepthRange[2], uint32_t absPartIdx) const;<br>@@ -327,6 +333,8 @@ public:<br> const CUData* getPUBelowLeftAdi(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset) const;<br> <br> #if ENABLE_SCC_EXT<br>+ void initSubCU(const CUData& ctu, const CUGeom& cuGeom, int qp, MV lastIntraBCMv[2] = 0);<br>+<br> void getIntraBCMVPsEncOnly(uint32_t absPartIdx, MV* MvPred, int& nbPred, int puIdx);<br> bool getDerivedBV(uint32_t absPartIdx, const MV& currentMv, MV& derivedMv, uint32_t width, uint32_t height);<br> bool isIntraBC(const CUData* cu, uint32_t absPartIdx) const;<br>diff --git a/source/common/lowpassdct.cpp b/source/common/lowpassdct.cpp<br>index f9922980f..e0f9c1ab7 100644<br>--- a/source/common/lowpassdct.cpp<br>+++ b/source/common/lowpassdct.cpp<br>@@ -58,7 +58,11 @@ static void lowPassDct8_c(const int16_t* src, int16_t* dst, intptr_t srcStride)<br> }<br> <br> // replace first coef with total block average<br>- dst[0] = (X265_DEPTH == 8) ? (totalSum << 1) : (totalSum >> ((X265_DEPTH - 9)));<br>+#if X265_DEPTH == 8<br>+ dst[0] = totalSum << 1;<br>+#else<br>+ dst[0] = totalSum >> (X265_DEPTH - 9);<br>+#endif<br> }<br> <br> static void lowPassDct16_c(const int16_t* src, int16_t* dst, intptr_t srcStride)<br>diff --git a/source/common/param.cpp b/source/common/param.cpp<br>index 833edb767..71437aa98 100755<br>--- a/source/common/param.cpp<br>+++ b/source/common/param.cpp<br>@@ -109,6 +109,33 @@ void x265_param_free(x265_param* p)<br> x265_free(p);<br> }<br> <br>+#if ENABLE_SCC_EXT<br>+enum SCCProfileName<br>+{<br>+ NONE = 0,<br>+ // The following are SCC profiles, which would map to the MAINSCC profile idc.<br>+ // The enumeration indicates the bit-depth constraint in the bottom 2 digits<br>+ // the chroma format in the next digit<br>+ // the intra constraint in the next digit<br>+ // If it is a SCC profile there is a '2' for the next digit.<br>+ // If it is a highthroughput , there is a '2' for the top digit else '1' for the top digit<br>+ SCC_MAIN = 121108,<br>+ SCC_MAIN_10 = 121110,<br>+ SCC_MAIN_444 = 121308,<br>+ SCC_MAIN_444_10 = 121310,<br>+};<br>+<br>+static const SCCProfileName validSCCProfileNames[1][4/* bit depth constraint 8=0, 10=1, 12=2, 14=3*/][4/*chroma format*/] =<br>+{<br>+ {<br>+ { NONE, SCC_MAIN, NONE, SCC_MAIN_444 }, // 8-bit intra for 400, 420, 422 and 444<br>+ { NONE, SCC_MAIN_10, NONE, SCC_MAIN_444_10 }, // 10-bit intra for 400, 420, 422 and 444<br>+ { NONE, NONE, NONE, NONE }, // 12-bit intra for 400, 420, 422 and 444<br>+ { NONE, NONE, NONE, NONE } // 16-bit intra for 400, 420, 422 and 444<br>+ },<br>+};<br>+#endif<br>+<br> void x265_param_default(x265_param* param)<br> {<br> #ifdef SVT_HEVC<br>@@ -1959,17 +1986,39 @@ int x265_check_params(x265_param* param)<br> if (param->bEnableAlpha)<br> {<br> CHECK((param->internalCsp != X265_CSP_I420), "Alpha encode supported only with i420a colorspace");<br>+ CHECK((param->internalBitDepth > 10), "BitDepthConstraint must be 8 and 10 for Scalable main profile");<br> CHECK((param->analysisMultiPassDistortion || param->analysisMultiPassRefine), "Alpha encode doesnot support multipass feature");<br>+ CHECK((param->analysisSave || param->analysisLoad), "Alpha encode doesnot support analysis save and load feature");<br> }<br> #endif<br> #if ENABLE_MULTIVIEW<br> CHECK((param->numViews > 2), "Multi-View Encoding currently support only 2 views");<br>- CHECK((param->numViews > 1) && (param->internalBitDepth != 8), "BitDepthConstraint must be 8 for Multiview main profile");<br>- CHECK((param->numViews > 1) && (param->analysisMultiPassDistortion || param->analysisMultiPassRefine), "Multiview encode doesnot support multipass feature");<br>+ if (param->numViews > 1)<br>+ {<br>+ CHECK(param->internalBitDepth != 8, "BitDepthConstraint must be 8 for Multiview main profile");<br>+ CHECK(param->analysisMultiPassDistortion || param->analysisMultiPassRefine, "Multiview encode doesnot support multipass feature");<br>+ CHECK(param->analysisSave || param->analysisLoad, "Multiview encode doesnot support analysis save and load feature");<br>+ }<br> #endif<br> #if ENABLE_SCC_EXT<br>+ bool checkValid = false;<br>+<br>+ if (!!param->bEnableSCC)<br>+ {<br>+ checkValid = param->keyframeMax <= 1 || param->totalFrames == 1;<br>+ if (checkValid) x265_log(param, X265_LOG_WARNING, "intra constraint flag must be 0 for SCC profiles. Disabling SCC \n");<br>+ checkValid = param->totalFrames == 1;<br>+ if (checkValid) x265_log(param, X265_LOG_WARNING, "one-picture-only constraint flag shall be 0 for SCC profiles. Disabling SCC \n");<br>+ const uint32_t bitDepthIdx = (param->internalBitDepth == 8 ? 0 : (param->internalBitDepth == 10 ? 1 : (param->internalBitDepth == 12 ? 2 : (param->internalBitDepth == 16 ? 3 : 4))));<br>+ const uint32_t chromaFormatIdx = uint32_t(param->internalCsp);<br>+ checkValid = !((bitDepthIdx > 2 || chromaFormatIdx > 3) ? false : (validSCCProfileNames[0][bitDepthIdx][chromaFormatIdx] != NONE));<br>+ if (checkValid) x265_log(param, X265_LOG_WARNING, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile. Disabling SCC \n");<br>+ if (checkValid)<br>+ param->bEnableSCC = 0;<br>+ }<br> CHECK(!!param->bEnableSCC&& param->rdLevel != 6, "Enabling scc extension in x265 requires rdlevel of 6 ");<br> #endif<br>+<br> return check_failed;<br> }<br> <br>diff --git a/source/common/slice.cpp b/source/common/slice.cpp<br>index 0c09df21b..5e5ad8a92 100644<br>--- a/source/common/slice.cpp<br>+++ b/source/common/slice.cpp<br>@@ -35,7 +35,6 @@ void Slice::createInterLayerReferencePictureSet(PicList& picList, PicList& refPi<br> <br> for (int i = 0; i < 1; i++)<br> {<br>- int layerIdRef = 0;// getRefPicLayerId(i);<br> Frame* refPic = picList.getPOC(m_poc, 0);<br> int viewIdCur = 0;<br> int viewIdZero = 1;<br>@@ -53,9 +52,12 @@ void Slice::createInterLayerReferencePictureSet(PicList& picList, PicList& refPi<br> }<br> #endif<br> <br>-void Slice::setRefPicList(PicList& picList, PicList& refPicSetInterLayer0, PicList& refPicSetInterLayer1, int sLayerId)<br>+#if ENABLE_MULTIVIEW<br>+void Slice::setRefPicList(PicList& picList, int sLayerId, PicList& refPicSetInterLayer0, PicList& refPicSetInterLayer1)<br>+#else<br>+void Slice::setRefPicList(PicList& picList, int sLayerId)<br>+#endif<br> {<br>- bool checkNumPocTotalCurr = m_param->bEnableSCC ? false : true;<br> if (m_sliceType == I_SLICE)<br> {<br> memset(m_refFrameList, 0, sizeof(m_refFrameList));<br>@@ -64,6 +66,7 @@ void Slice::setRefPicList(PicList& picList, PicList& refPicSetInterLayer0, PicLi<br> m_numRefIdx[1] = m_numRefIdx[0] = 0;<br> <br> #if ENABLE_SCC_EXT<br>+ bool checkNumPocTotalCurr = m_param->bEnableSCC ? false : true;<br> if (!checkNumPocTotalCurr)<br> {<br> if (m_rps.numberOfPictures == 0)<br>@@ -94,6 +97,7 @@ void Slice::setRefPicList(PicList& picList, PicList& refPicSetInterLayer0, PicLi<br> #endif<br> <br> #if ENABLE_SCC_EXT<br>+ bool checkNumPocTotalCurr = m_param->bEnableSCC ? false : true;<br> if (!checkNumPocTotalCurr && m_rps.numberOfPictures == 0)<br> {<br> Frame* prevPic = picList.getPOC(X265_MAX(0, m_poc - 1));<br>diff --git a/source/common/slice.h b/source/common/slice.h<br>index 041bc451e..0d0b2efb4 100644<br>--- a/source/common/slice.h<br>+++ b/source/common/slice.h<br>@@ -434,9 +434,11 @@ public:<br> <br> void disableWeights();<br> <br>- void setRefPicList(PicList& picList, PicList& refPicSetInterLayer0, PicList& refPicSetInterLayer1, int viewId);<br> #if ENABLE_MULTIVIEW<br>+ void setRefPicList(PicList& picList, int viewId, PicList& refPicSetInterLayer0, PicList& refPicSetInterLayer1);<br> void createInterLayerReferencePictureSet(PicList& picList, PicList& refPicSetInterLayer0, PicList& refPicSetInterLayer1);<br>+#else<br>+ void setRefPicList(PicList& picList, int viewId);<br> #endif<br> <br> #if ENABLE_SCC_EXT<br>diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp<br>index d60747cc0..c99c796af 100644<br>--- a/source/encoder/analysis.cpp<br>+++ b/source/encoder/analysis.cpp<br>@@ -2870,7 +2870,11 @@ void Analysis::recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t q<br> continue;<br> MV mvp;<br> <br>+#if (ENABLE_MULTIVIEW || ENABLE_SCC_EXT)<br> int numMvc = mode.cu.getPMV(mode.interNeighbours, list, ref, mode.amvpCand[list][ref], mvc, part, pu.puAbsPartIdx);<br>+#else<br>+ int numMvc = mode.cu.getPMV(mode.interNeighbours, list, ref, mode.amvpCand[list][ref], mvc);<br>+#endif<br> mvp = mode.amvpCand[list][ref][mode.cu.m_mvpIdx[list][pu.puAbsPartIdx]];<br> if (m_param->interRefine == 1)<br> {<br>@@ -3413,7 +3417,7 @@ void Analysis::checkRDCostIntraBCMerge2Nx2N(Mode& mergeIBC, const CUGeom& cuGeom<br> {<br> interDirNeighbours[ui] = 0;<br> }<br>- int org_qp;<br>+ int8_t org_qp;<br> int xPos = cu.m_cuPelX;<br> int yPos = cu.m_cuPelY;<br> int width = 1 << cu.m_log2CUSize[0];<br>@@ -3426,7 +3430,7 @@ void Analysis::checkRDCostIntraBCMerge2Nx2N(Mode& mergeIBC, const CUGeom& cuGeom<br> cu.roundMergeCandidates(cMvFieldNeighbours, numValidMergeCand);<br> restrictBipredMergeCand(&cu, 0, cMvFieldNeighbours, interDirNeighbours, numValidMergeCand);<br> <br>- for (uint32_t mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand)<br>+ for (uint8_t mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand)<br> {<br> if (interDirNeighbours[mergeCand] != 1)<br> {<br>@@ -3533,7 +3537,11 @@ void Analysis::checkInter_rd0_4(Mode& interMode, const CUGeom& cuGeom, PartSize<br> }<br> }<br> <br>+#if ENABLE_SCC_EXT<br> void Analysis::checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, uint32_t refMask[2], MV* iMVCandList)<br>+#else<br>+void Analysis::checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, uint32_t refMask[2])<br>+#endif<br> {<br> interMode.initCosts();<br> interMode.cu.setPartSizeSubParts(partSize);<br>@@ -3570,7 +3578,11 @@ void Analysis::checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize<br> }<br> }<br> <br>+#if ENABLE_SCC_EXT<br> predInterSearch(interMode, cuGeom, m_csp != X265_CSP_I400 && m_frame->m_fencPic->m_picCsp != X265_CSP_I400, refMask, iMVCandList);<br>+#else<br>+ predInterSearch(interMode, cuGeom, m_csp != X265_CSP_I400 && m_frame->m_fencPic->m_picCsp != X265_CSP_I400, refMask);<br>+#endif<br> <br> /* predInterSearch sets interMode.sa8dBits, but this is ignored */<br> encodeResAndCalcRdInterCU(interMode, cuGeom);<br>diff --git a/source/encoder/analysis.h b/source/encoder/analysis.h<br>index 586e50ef0..e5fa57367 100644<br>--- a/source/encoder/analysis.h<br>+++ b/source/encoder/analysis.h<br>@@ -195,11 +195,14 @@ protected:<br> <br> /* measure inter options */<br> void checkInter_rd0_4(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, uint32_t refmask[2]);<br>- void checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, uint32_t refmask[2], MV* iMVCandList = NULL);<br>-<br>+#if !ENABLE_SCC_EXT<br>+ void checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, uint32_t refmask[2]);<br>+#endif<br> void checkBidir2Nx2N(Mode& inter2Nx2N, Mode& bidir2Nx2N, const CUGeom& cuGeom);<br> <br> #if ENABLE_SCC_EXT<br>+ void checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, uint32_t refmask[2], MV* iMVCandList = NULL);<br>+<br> void checkRDCostIntraBCMerge2Nx2N(Mode& merge, const CUGeom& cuGeom);<br> void checkIntraBC_rd5_6(Mode& intraBCMode, const CUGeom& cuGeom, PartSize ePartSize, bool testOnlyPred, bool bUse1DSearchFor8x8, IBC& ibc, MV* iMVCandList = NULL);<br> #endif<br>diff --git a/source/encoder/dpb.cpp b/source/encoder/dpb.cpp<br>index caf73ad6d..ae26c5518 100644<br>--- a/source/encoder/dpb.cpp<br>+++ b/source/encoder/dpb.cpp<br>@@ -295,7 +295,11 @@ void DPB::prepareEncode(Frame *newFrame)<br> else<br> #endif<br> slice->m_numRefIdx[1] = X265_MIN(newFrame->m_param->bBPyramid ? 2 : 1, slice->m_rps.numberOfPositivePictures);<br>- slice->setRefPicList(m_picList, newFrame->refPicSetInterLayer0, newFrame->refPicSetInterLayer1, layer);<br>+#if ENABLE_MULTIVIEW<br>+ slice->setRefPicList(m_picList, layer, newFrame->refPicSetInterLayer0, newFrame->refPicSetInterLayer1);<br>+#else<br>+ slice->setRefPicList(m_picList, layer);<br>+#endif<br> <br> X265_CHECK(slice->m_sliceType != B_SLICE || slice->m_numRefIdx[1], "B slice without L1 references (non-fatal)\n");<br> <br>@@ -419,7 +423,7 @@ void DPB::computeRPS(int curPoc, int tempId, bool isRAP, RPS * rps, unsigned int<br> if ((!m_bTemporalSublayer || (iterPic->m_tempLayer <= tempId)) && ((m_lastIDR >= curPoc) || (m_lastIDR <= iterPic->m_poc)))<br> {<br> #if ENABLE_MULTIVIEW<br>- if (iterPic->m_param->numViews > 1 && layer && numNeg == iterPic->m_param->maxNumReferences - 1 && (iterPic->m_poc - curPoc) < 0)<br>+ if (iterPic->m_param->numViews > 1 && layer && numNeg == (uint8_t)(iterPic->m_param->maxNumReferences - 1) && (iterPic->m_poc - curPoc) < 0)<br> {<br> iterPic = iterPic->m_next;<br> continue;<br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index 6533fc3c6..f5de400a4 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -1986,7 +1986,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br> /* Free up inputPic->analysisData since it has already been used */<br> if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))<br> x265_free_analysis_data(m_param, &outFrame->m_analysisData);<br>- if (pic_out && (&pic_out[sLayer]))<br>+ if (pic_out)<br> {<br> PicYuv* recpic = outFrame->m_reconPic[0];<br> pic_out[sLayer].poc = slice->m_poc;<br>@@ -2069,7 +2069,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br> }<br> if (m_param->rc.bStatWrite && (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion))<br> {<br>- if (pic_out && (&pic_out[sLayer]))<br>+ if (pic_out)<br> {<br> pic_out[sLayer].analysisData.poc = pic_out[sLayer].poc;<br> pic_out[sLayer].analysisData.interData = outFrame->m_analysisData.interData;<br>@@ -2163,7 +2163,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br> if (m_param->rc.bStatWrite)<br> if (m_rateControl->writeRateControlFrameStats(outFrame, &curEncoder->m_rce))<br> m_aborted = true;<br>- if (pic_out && (&pic_out[sLayer]))<br>+ if (pic_out)<br> {<br> /* m_rcData is allocated for every frame */<br> pic_out[sLayer].rcData = outFrame->m_rcData;<br>@@ -2197,7 +2197,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br> }<br> <br> /* Allow this frame to be recycled if no frame encoders are using it for reference */<br>- if (!pic_out || !(&pic_out[sLayer]))<br>+ if (!pic_out)<br> {<br> ATOMIC_DEC(&outFrame->m_countRefEncoders);<br> m_dpb->recycleUnreferenced();<br>@@ -2473,14 +2473,14 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br> switch (m_param->selectiveSAO)<br> {<br> case 3: if (!IS_REFERENCED(frameEnc[layer]))<br>- slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>- break;<br>+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>+ break;<br> case 2: if (!!m_param->bframes && slice->m_sliceType == B_SLICE)<br>- slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>- break;<br>+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>+ break;<br> case 1: if (slice->m_sliceType != I_SLICE)<br>- slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>- break;<br>+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>+ break;<br> }<br> }<br> else<br>@@ -3369,7 +3369,11 @@ void Encoder::getStreamHeaders(NALList& list, Entropy& sbacCoder, Bitstream& bs)<br> <br> /* headers for start of bitstream */<br> bs.resetBits();<br>+#if ENABLE_ALPHA || ENABLE_MULTIVIEW<br> sbacCoder.codeVPS(m_vps, m_sps);<br>+#else<br>+ sbacCoder.codeVPS(m_vps);<br>+#endif<br> bs.writeByteAlignment();<br> list.serialize(NAL_UNIT_VPS, bs);<br> <br>@@ -3503,7 +3507,7 @@ void Encoder::initVPS(VPS *vps)<br> if (m_param->numScalableLayers > 1)<br> {<br> vps->vps_extension_flag = true;<br>- int dimIdLen = 0, auxDimIdLen = 0, maxAuxId = 1, auxId[2] = { 0,1 };<br>+ uint8_t dimIdLen = 0, auxDimIdLen = 0, maxAuxId = 1, auxId[2] = { 0,1 };<br> vps->splitting_flag = false;<br> memset(vps->m_scalabilityMask, 0, sizeof(vps->m_scalabilityMask));<br> memset(vps->m_layerIdInNuh, 0, sizeof(vps->m_layerIdInNuh));<br>@@ -3524,7 +3528,7 @@ void Encoder::initVPS(VPS *vps)<br> }<br> vps->m_dimensionIdLen[0] = dimIdLen;<br> <br>- for (int i = 1; i < m_param->numScalableLayers; i++)<br>+ for (uint8_t i = 1; i < m_param->numScalableLayers; i++)<br> {<br> vps->m_layerIdInNuh[i] = i;<br> vps->m_dimensionId[i][0] = i;<br>diff --git a/source/encoder/entropy.cpp b/source/encoder/entropy.cpp<br>index 834d0014b..18978f26e 100644<br>--- a/source/encoder/entropy.cpp<br>+++ b/source/encoder/entropy.cpp<br>@@ -230,7 +230,11 @@ Entropy::Entropy()<br> X265_CHECK(sizeof(m_contextState) >= sizeof(m_contextState[0]) * MAX_OFF_CTX_MOD, "context state table is too small\n");<br> }<br> <br>+#if ENABLE_ALPHA || ENABLE_MULTIVIEW<br> void Entropy::codeVPS(const VPS& vps, const SPS& sps)<br>+#else<br>+void Entropy::codeVPS(const VPS& vps)<br>+#endif<br> {<br> int maxLayers = (vps.m_numLayers > 1 || vps.m_numViews > 1) + 1;<br> WRITE_CODE(0, 4, "vps_video_parameter_set_id");<br>@@ -305,7 +309,7 @@ void Entropy::codeVPS(const VPS& vps, const SPS& sps)<br> WRITE_CODE(vps.ptl.levelIdc, 8, "general_level_idc");<br> if (vps.maxTempSubLayers > 1)<br> {<br>- for (int i = 0; i < vps.maxTempSubLayers - 1; i++)<br>+ for (uint32_t i = 0; i < vps.maxTempSubLayers - 1; i++)<br> {<br> WRITE_FLAG(0, "sub_layer_profile_present_flag[i]");<br> WRITE_FLAG(0, "sub_layer_level_present_flag[i]");<br>@@ -389,7 +393,7 @@ void Entropy::codeVPS(const VPS& vps, const SPS& sps)<br> for (int i = 1; i < vps.m_vpsNumLayerSetsMinus1 + 1; i++)<br> {<br> WRITE_FLAG(vps.maxTempSubLayers > 1, "sub_layer_flag_info_present_flag");<br>- for (int j = 0; j < vps.maxTempSubLayers ; j++)<br>+ for (uint32_t j = 0; j < vps.maxTempSubLayers ; j++)<br> {<br> if(j > 0)<br> WRITE_FLAG(vps.maxTempSubLayers > 1, "sub_layer_dpb_info_present_flag");<br>@@ -474,7 +478,7 @@ void Entropy::codeVPS(const VPS& vps, const SPS& sps)<br> for (int i = 1; i < vps.m_vpsNumLayerSetsMinus1 + 1; i++)<br> {<br> WRITE_FLAG(vps.maxTempSubLayers > 1, "sub_layer_flag_info_present_flag");<br>- for (int j = 0; j < vps.maxTempSubLayers; j++)<br>+ for (uint32_t j = 0; j < vps.maxTempSubLayers; j++)<br> {<br> if (j > 0)<br> WRITE_FLAG(vps.maxTempSubLayers > 1, "sub_layer_dpb_info_present_flag");<br>diff --git a/source/encoder/entropy.h b/source/encoder/entropy.h<br>index 4271701c7..fd6fa8999 100644<br>--- a/source/encoder/entropy.h<br>+++ b/source/encoder/entropy.h<br>@@ -141,7 +141,11 @@ public:<br> void loadIntraDirModeLuma(const Entropy& src);<br> void copyState(const Entropy& other);<br> <br>+#if ENABLE_ALPHA || ENABLE_MULTIVIEW<br> void codeVPS(const VPS& vps, const SPS& sps);<br>+#else<br>+ void codeVPS(const VPS& vps);<br>+#endif<br> void codeSPS(const SPS& sps, const ScalingList& scalingList, const ProfileTierLevel& ptl, int layer = 0);<br> void codePPS( const PPS& pps, bool filerAcross, int iPPSInitQpMinus26, int layer = 0);<br> void codeVUI(const VUI& vui, int maxSubTLayers, bool bEmitVUITimingInfo, bool bEmitVUIHRDInfo, int layer = 0);<br>diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp<br>index e21dbfa85..b6f2d6ed1 100644<br>--- a/source/encoder/frameencoder.cpp<br>+++ b/source/encoder/frameencoder.cpp<br>@@ -668,8 +668,8 @@ void FrameEncoder::compressFrame(int layer)<br> {<br> int numAQPartInWidth = (m_frame[0]->m_fencPic->m_picWidth + aqPartWidth - 1) / aqPartWidth;<br> int numAQPartInHeight = (m_frame[0]->m_fencPic->m_picHeight + aqPartHeight - 1) / aqPartHeight;<br>- memset(m_frame[layer]->m_lowres.pAQLayer[d].dQpOffset, 0.0, sizeof(double)*numAQPartInWidth* numAQPartInHeight);<br>- memset(m_frame[layer]->m_lowres.pAQLayer[d].dCuTreeOffset, 0.0, sizeof(double)* numAQPartInWidth* numAQPartInHeight);<br>+ memset(m_frame[layer]->m_lowres.pAQLayer[d].dQpOffset, 0, sizeof(double)*numAQPartInWidth* numAQPartInHeight);<br>+ memset(m_frame[layer]->m_lowres.pAQLayer[d].dCuTreeOffset, 0, sizeof(double)* numAQPartInWidth* numAQPartInHeight);<br> }<br> }<br> }<br>@@ -2348,6 +2348,7 @@ void FrameEncoder::readAomModel(AomFilmGrainCharacteristics* m_aomFilmGrain, FIL<br> {<br> char const* errorMessage = "Error reading Aom FilmGrain characteristics\n";<br> AomFilmGrain m_afg;<br>+ m_afg.m_chroma_scaling_from_luma = 0;<br> x265_fread((char*)&m_aomFilmGrain->m_apply_grain, sizeof(int32_t), 1, Aomfilmgrain, errorMessage);<br> x265_fread((char*)&m_aomFilmGrain->m_grain_seed, sizeof(uint16_t), 1, Aomfilmgrain, errorMessage);<br> x265_fread((char*)&m_aomFilmGrain->m_update_grain, sizeof(int32_t), 1, Aomfilmgrain, errorMessage);<br>@@ -2454,7 +2455,7 @@ void FrameEncoder::vmafFrameLevelScore()<br> <br> Frame** FrameEncoder::getEncodedPicture(NALList& output)<br> {<br>- if (m_frame && m_frame[0])<br>+ if (m_frame[0] && (m_param->numLayers <= 1 || m_frame[1]))<br> {<br> /* block here until worker thread completes */<br> m_done.wait();<br>diff --git a/source/encoder/level.cpp b/source/encoder/level.cpp<br>index defcc7950..c2f840325 100644<br>--- a/source/encoder/level.cpp<br>+++ b/source/encoder/level.cpp<br>@@ -60,33 +60,6 @@ LevelSpec levels[] =<br> { MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, 1, Level::LEVEL8_5, "8.5", 85 },<br> };<br> <br>-#if ENABLE_SCC_EXT<br>-enum SCCProfileName<br>-{<br>- NONE = 0,<br>- // The following are SCC profiles, which would map to the MAINSCC profile idc.<br>- // The enumeration indicates the bit-depth constraint in the bottom 2 digits<br>- // the chroma format in the next digit<br>- // the intra constraint in the next digit<br>- // If it is a SCC profile there is a '2' for the next digit.<br>- // If it is a highthroughput , there is a '2' for the top digit else '1' for the top digit<br>- SCC_MAIN = 121108,<br>- SCC_MAIN_10 = 121110,<br>- SCC_MAIN_444 = 121308,<br>- SCC_MAIN_444_10 = 121310,<br>-};<br>-<br>-static const SCCProfileName validSCCProfileNames[1][4/* bit depth constraint 8=0, 10=1, 12=2, 14=3*/][4/*chroma format*/] =<br>-{<br>- {<br>- { NONE, SCC_MAIN, NONE, SCC_MAIN_444 }, // 8-bit intra for 400, 420, 422 and 444<br>- { NONE, SCC_MAIN_10, NONE, SCC_MAIN_444_10 }, // 10-bit intra for 400, 420, 422 and 444<br>- { NONE, NONE, NONE, NONE }, // 12-bit intra for 400, 420, 422 and 444<br>- { NONE, NONE, NONE, NONE } // 16-bit intra for 400, 420, 422 and 444<br>- },<br>-};<br>-#endif<br>-<br> static inline int _confirm(x265_param* param, bool bflag, const char* message)<br> {<br> if (!bflag)<br>@@ -282,24 +255,6 @@ void determineLevel(const x265_param ¶m, VPS& vps)<br> break;<br> }<br> <br>-#if ENABLE_SCC_EXT<br>- x265_param m_param = param;<br>-#define CHECK(expr, msg) check_failed |= _confirm(&m_param, expr, msg)<br>- int check_failed = 0; /* abort if there is a fatal configuration problem */<br>-<br>- if (vps.ptl.profileIdc[0] == Profile::MAINSCC)<br>- {<br>- CHECK(vps.ptl.lowerBitRateConstraintFlag == false && vps.ptl.intraConstraintFlag == false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");<br>- CHECK(param.bEnableSCC && !(vps.ptl.profileIdc[0] == Profile::MAINSCC), "UseIntraBlockCopy must not be enabled unless the SCC profile is being used.");<br>- CHECK(vps.ptl.intraConstraintFlag, "intra constraint flag must be 0 for SCC profiles");<br>- CHECK(vps.ptl.onePictureOnlyConstraintFlag, "one-picture-only constraint flag shall be 0 for SCC profiles");<br>- const uint32_t bitDepthIdx = (vps.ptl.bitDepthConstraint == 8 ? 0 : (vps.ptl.bitDepthConstraint == 10 ? 1 : (vps.ptl.bitDepthConstraint == 12 ? 2 : (vps.ptl.bitDepthConstraint == 16 ? 3 : 4))));<br>- const uint32_t chromaFormatIdx = uint32_t(vps.ptl.chromaFormatConstraint);<br>- const bool bValidProfile = (bitDepthIdx > 2 || chromaFormatIdx > 3) ? false : (validSCCProfileNames[0][bitDepthIdx][chromaFormatIdx] != NONE);<br>- CHECK(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");<br>- }<br>-#endif<br>-<br> static const char* profiles[] = { "None", "Main", "Main 10", "Main Still Picture", "RExt", "", "", "", "", "Main Scc" };<br> static const char *tiers[] = { "Main", "High" };<br> <br>diff --git a/source/encoder/nal.cpp b/source/encoder/nal.cpp<br>index 093c91016..fe9bb9086 100644<br>--- a/source/encoder/nal.cpp<br>+++ b/source/encoder/nal.cpp<br>@@ -114,7 +114,7 @@ void NALList::serialize(NalUnitType nalUnitType, const Bitstream& bs, int layerI<br> * nuh_reserved_zero_6bits 6-bits<br> * nuh_temporal_id_plus1 3-bits */<br> out[bytes++] = (uint8_t)nalUnitType << 1;<br>- out[bytes++] = (layerId << 3) | (temporalID);<br>+ out[bytes++] = (uint8_t)((layerId << 3) | (temporalID));<br> <br> /* 7.4.1 ...<br> * Within the NAL unit, the following three-byte sequences shall not occur at<br>diff --git a/source/encoder/search.cpp b/source/encoder/search.cpp<br>index ebd85dd52..e398843a8 100644<br>--- a/source/encoder/search.cpp<br>+++ b/source/encoder/search.cpp<br>@@ -2124,7 +2124,11 @@ void Search::singleMotionEstimation(Search& master, Mode& interMode, const Predi<br> <br> // 12 mv candidates including lowresMV<br> MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 2];<br>+#if (ENABLE_MULTIVIEW || ENABLE_SCC_EXT)<br> int numMvc = interMode.cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc, 0, pu.puAbsPartIdx);<br>+#else<br>+ int numMvc = interMode.cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc);<br>+#endif<br> <br> const MV* amvp = interMode.amvpCand[list][ref];<br> int mvpIdx = selectMVP(interMode.cu, pu, amvp, list, ref);<br>@@ -2213,7 +2217,11 @@ void Search::searchMV(Mode& interMode, int list, int ref, MV& outmv, MV mvp[3],<br> }<br> }<br> /* find the best inter prediction for each PU of specified mode */<br>+#if ENABLE_SCC_EXT<br> void Search::predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChromaMC, uint32_t refMasks[2], MV* iMVCandList)<br>+#else<br>+void Search::predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChromaMC, uint32_t refMasks[2])<br>+#endif<br> {<br> ProfileCUScope(interMode.cu, motionEstimationElapsedTime, countMotionEstimate);<br> <br>@@ -2285,7 +2293,11 @@ void Search::predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChroma<br> #endif<br> bits += getTUBits(ref, numIdx);<br> <br>+#if (ENABLE_MULTIVIEW || ENABLE_SCC_EXT)<br> int numMvc = cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc, puIdx, pu.puAbsPartIdx);<br>+#else<br>+ int numMvc = cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc);<br>+#endif<br> const MV* amvp = interMode.amvpCand[list][ref];<br> int mvpIdx = selectMVP(cu, pu, amvp, list, ref);<br> MV mvmin, mvmax, outmv, mvp;<br>@@ -2453,7 +2465,11 @@ void Search::predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChroma<br> uint32_t bits = m_listSelBits[list] + MVP_IDX_BITS;<br> bits += getTUBits(ref, numIdx);<br> <br>+#if (ENABLE_MULTIVIEW || ENABLE_SCC_EXT)<br> int numMvc = cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc, puIdx, pu.puAbsPartIdx);<br>+#else<br>+ int numMvc = cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc);<br>+#endif<br> <br> const MV* amvp = interMode.amvpCand[list][ref];<br> int mvpIdx = selectMVP(cu, pu, amvp, list, ref);<br>@@ -3490,10 +3506,10 @@ void Search::setIntraSearchRange(Mode& intraBCMode, MV& pred, int puIdx, int roi<br> CUData& cu = intraBCMode.cu;<br> cu.clipMv(mvPred);<br> int srLeft, srRight, srTop, srBottom;<br>- int width, height;<br>+ int puWidth, puHeight;<br> uint32_t partAddr;<br> <br>- cu.getPartIndexAndSize(puIdx, partAddr, width, height);<br>+ cu.getPartIndexAndSize(puIdx, partAddr, puWidth, puHeight);<br> <br> const uint32_t lcuWidth = m_param->maxCUSize;<br> const uint32_t lcuHeight = m_param->maxCUSize;<br>@@ -3520,8 +3536,8 @@ void Search::setIntraSearchRange(Mode& intraBCMode, MV& pred, int puIdx, int roi<br> pTestCU = pTestCU->m_cuLeft, width += lcuWidth)<br> {<br> }<br>- uint32_t maxXsr = (cuPelX % lcuWidth) + X265_MIN(maxWidth, width);<br>- uint32_t maxYsr = cuPelY % lcuHeight;<br>+ int maxXsr = (cuPelX % lcuWidth) + X265_MIN(maxWidth, width);<br>+ int maxYsr = cuPelY % lcuHeight;<br> <br> if (cu.m_chromaFormat == X265_CSP_I420 || cu.m_chromaFormat == X265_CSP_I422) maxXsr &= ~0x4;<br> if (cu.m_chromaFormat == X265_CSP_I420) maxYsr &= ~0x4;<br>@@ -3638,7 +3654,7 @@ bool Search::predIntraBCSearch(Mode& intraBCMode, const CUGeom& cuGeom, bool bCh<br> int mrgIdxTemp = -1;<br> int xCUStart = cu.m_cuPelX;<br> int yCUStart = cu.m_cuPelY;<br>- int xStartInCU, yStartInCU;<br>+ int xStartInCU = 0, yStartInCU = 0;<br> if (ePartSize == SIZE_2Nx2N)<br> xStartInCU = yStartInCU = 0;<br> else if (ePartSize == SIZE_2NxN)<br>@@ -3664,7 +3680,6 @@ bool Search::predIntraBCSearch(Mode& intraBCMode, const CUGeom& cuGeom, bool bCh<br> cu.setPURefIdx(1, REF_NOT_VALID, pu.puAbsPartIdx, puIdx);<br> cu.setPUInterDir(1, pu.puAbsPartIdx, puIdx);<br> motionCompensation(cu, pu, tmpPredYuv, 1, 1);<br>- int temp;<br> for (uint32_t ch = TEXT_LUMA; ch < MAX_NUM_COMPONENT; ch++)<br> {<br> int tempHeight, tempWidth;<br>@@ -3816,9 +3831,6 @@ bool Search::predIntraBCSearch(Mode& intraBCMode, const CUGeom& cuGeom, bool bCh<br> <br> cu.m_mvd[0][pu.puAbsPartIdx] = mvd;<br> cu.m_mvpIdx[0][pu.puAbsPartIdx] = (uint8_t)mvpIdxBest;<br>-<br>- cu.m_mvd[1][pu.puAbsPartIdx] = zeroMv;<br>- cu.m_mvpIdx[1][pu.puAbsPartIdx] = REF_NOT_VALID;<br> }<br> else<br> {<br>@@ -3939,7 +3951,7 @@ bool Search::predMixedIntraBCInterSearch(Mode& intraBCMixedMode, const CUGeom& c<br> int mrgIdxTemp = -1;<br> int xCUStart = cu.m_cuPelX;<br> int yCUStart = cu.m_cuPelY;<br>- int xStartInCU, yStartInCU;<br>+ int xStartInCU = 0, yStartInCU = 0;<br> if (ePartSize == SIZE_2Nx2N)<br> xStartInCU = yStartInCU = 0;<br> else if (ePartSize == SIZE_2NxN)<br>diff --git a/source/encoder/search.h b/source/encoder/search.h<br>index f12ac02e0..df7ad90dd 100644<br>--- a/source/encoder/search.h<br>+++ b/source/encoder/search.h<br>@@ -319,7 +319,9 @@ public:<br> void encodeIntraInInter(Mode& intraMode, const CUGeom& cuGeom);<br> <br> // estimation inter prediction (non-skip)<br>- void predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChromaMC, uint32_t masks[2], MV* iMVCandList = NULL);<br>+#if !ENABLE_SCC_EXT<br>+ void predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChromaMC, uint32_t masks[2]);<br>+#endif<br> void searchMV(Mode& interMode, int list, int ref, MV& outmv, MV mvp[3], int numMvc, MV* mvc);<br> // encode residual and compute rd-cost for inter mode<br> void encodeResAndCalcRdInterCU(Mode& interMode, const CUGeom& cuGeom);<br>@@ -340,6 +342,7 @@ public:<br> MV getLowresMV(const CUData& cu, const PredictionUnit& pu, int list, int ref);<br> <br> #if ENABLE_SCC_EXT<br>+ void predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChromaMC, uint32_t masks[2], MV* iMVCandList = NULL);<br> bool predIntraBCSearch(Mode& intraBCMode, const CUGeom& cuGeom, bool bChromaMC, PartSize ePartSize, bool testOnlyPred, bool bUse1DSearchFor8x8, IBC& ibc);<br> void intraBlockCopyEstimate(Mode& intraBCMode, const CUGeom& cuGeom, int puIdx, MV* pred, MV& mv, uint32_t& cost, bool testOnlyPred, bool bUse1DSearchFor8x8, IBC& ibc);<br> void setIntraSearchRange(Mode& intraBCMode, MV& pred, int puIdx, int roiWidth, int roiHeight, MV& searchRangeLT, MV& searchRangeRB);<br>diff --git a/source/encoder/sei.h b/source/encoder/sei.h<br>index 1fa4dc69b..a33cb94e9 100644<br>--- a/source/encoder/sei.h<br>+++ b/source/encoder/sei.h<br>@@ -360,14 +360,17 @@ class SEIThreeDimensionalReferenceDisplaysInfo : public SEI<br> {<br> public:<br> SEIThreeDimensionalReferenceDisplaysInfo()<br>+ : m_numRefDisplaysMinus1(0),<br>+ m_refViewingDistanceFlag(false),<br>+ m_additionalShiftPresentFlag(false)<br> {<br> m_payloadType = THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO;<br> m_payloadSize = 0;<br> }<br> <br>- int m_numRefDisplaysMinus1 = 0;<br>- bool m_refViewingDistanceFlag = false;<br>- bool m_additionalShiftPresentFlag = false;<br>+ int m_numRefDisplaysMinus1;<br>+ bool m_refViewingDistanceFlag;<br>+ bool m_additionalShiftPresentFlag;<br> void writeSEI(const SPS&)<br> {<br> WRITE_UVLC(31, "prec_ref_display_width");<br>@@ -432,26 +435,66 @@ public:<br> }<br> };<br> <br>+static int temp_sign_r[3][3] = { {0,1,0},{1,0,0},{0,1,1} };<br>+static int temp_exponent_r[3][3] = { {10,20,11},{10,5,11},{2,20,11} };<br>+static int temp_mantissa_r[3][3] = { {4,9,1},{0,3,4},{3,3,7} };<br>+static int temp_sign_t[1][3] = { { 0,1,0 } };<br>+static int temp_exponent_t[1][3] = { { 0,10,5 } };<br>+static int temp_mantissa_t[1][3] = { { 1,8,9 } };<br>+static int temp_length_mantissa_r[3][3] = { {10,20,11},{10,5,11},{2,20,11} };<br>+static int temp_length_mantissa_t[1][3] = { { 1,10,5 } };<br>+<br> class SEIMultiviewAcquisitionInfo : public SEI<br> {<br> public:<br> SEIMultiviewAcquisitionInfo()<br>+ :sign_r(),<br>+ exponent_r(),<br>+ mantissa_r(),<br>+ sign_t(),<br>+ exponent_t(),<br>+ mantissa_t(),<br>+ length_mantissa_r(),<br>+ length_mantissa_t(),<br>+ m_intrinsicParamFlag(true),<br>+ m_extrinsicParamFlag(true),<br>+ m_intrinsicParamsEqualFlag(true)<br> {<br> m_payloadType = MULTIVIEW_ACQUISITION_INFO;<br> m_payloadSize = 0;<br>+<br>+ for (int i = 0; i <= 0; i++)<br>+ {<br>+ for (int j = 0; j <= 2; j++) /* row */<br>+ {<br>+ for (int k = 0; k <= 2; k++) /* column */<br>+ {<br>+ temp_sign_r[j][k] = sign_r[j][k];<br>+ temp_exponent_r[j][k] = exponent_r[j][k];<br>+ temp_mantissa_r[j][k] = mantissa_r[j][k];<br>+ temp_length_mantissa_r[j][k] = length_mantissa_r[j][k];<br>+ }<br>+ temp_sign_t[i][j] = sign_t[i][j];<br>+ temp_exponent_t[i][j] = exponent_t[i][j];<br>+ temp_mantissa_t[i][j] = mantissa_t[i][j];<br>+ temp_length_mantissa_t[i][j] = length_mantissa_t[i][j];<br>+ }<br>+ }<br> }<br> <br>- int sign_r[3][3] = { {0,1,0},{1,0,0},{0,1,1} };<br>- int exponent_r[3][3] = { {10,20,11},{10,5,11},{2,20,11} };<br>- int mantissa_r[3][3] = { {4,9,1},{0,3,4},{3,3,7} };<br>- int sign_t[1][3] = { 0,1,0 };<br>- int exponent_t[1][3] = { 0,10,5 };<br>- int mantissa_t[1][3] = { 1,8,9 };<br>- int lenght_mantissa_r[3][3] = { {10,20,11},{10,5,11},{2,20,11} };<br>- int length_mantissa_t[1][3] = { 1,10,5 };<br>- bool m_intrinsicParamFlag = true;<br>- bool m_extrinsicParamFlag = true;<br>- bool m_intrinsicParamsEqualFlag = true;<br>+ int sign_r[3][3];<br>+ int exponent_r[3][3];<br>+ int mantissa_r[3][3];<br>+ int sign_t[1][3];<br>+ int exponent_t[1][3];<br>+ int mantissa_t[1][3];<br>+ int length_mantissa_r[3][3];<br>+ int length_mantissa_t[1][3];<br>+<br>+ bool m_intrinsicParamFlag;<br>+ bool m_extrinsicParamFlag;<br>+ bool m_intrinsicParamsEqualFlag;<br>+<br> void writeSEI(const SPS& sps)<br> {<br> WRITE_FLAG(m_intrinsicParamFlag, "intrinsic_param_flag");<br>@@ -495,7 +538,7 @@ public:<br> {<br> WRITE_FLAG(sign_r[j][k], "sign_r");<br> WRITE_CODE(exponent_r[j][k], 6, "exponent_r");<br>- WRITE_CODE(mantissa_r[j][k], lenght_mantissa_r[j][k], "mantissa_r");<br>+ WRITE_CODE(mantissa_r[j][k], length_mantissa_r[j][k], "mantissa_r");<br> }<br> WRITE_FLAG(sign_t[i][j], "sign_t");<br> WRITE_CODE(exponent_t[i][j], 6, "exponent_t");<br>diff --git a/source/x265.h b/source/x265.h<br>index c5082b6a9..13c4a47e2 100644<br>--- a/source/x265.h<br>+++ b/source/x265.h<br>@@ -637,8 +637,6 @@ typedef enum<br> <br> #if ENABLE_MULTIVIEW<br> #define MAX_VIEWS 2<br>-#define MAX_VPS_NUM_SCALABILITY_TYPES 16<br>-#define MAX_VPS_LAYER_ID_PLUS1 MAX_VIEWS<br> #define MULTIVIEW_SCALABILITY_IDX 1<br> #else<br> #define MAX_VIEWS 1<br>@@ -646,14 +644,15 @@ typedef enum<br> <br> #if ENABLE_ALPHA<br> #define MAX_SCALABLE_LAYERS 2<br>-#define MAX_VPS_NUM_SCALABILITY_TYPES 16<br>-#define MAX_VPS_LAYER_ID_PLUS1 MAX_SCALABLE_LAYERS<br> #else<br> #define MAX_SCALABLE_LAYERS 1<br> #endif<br> <br> #if ENABLE_ALPHA || ENABLE_MULTIVIEW<br> #define MAX_LAYERS 2<br>+#define MAX_VPS_NUM_SCALABILITY_TYPES 16<br>+#define MAX_VPS_LAYER_ID_PLUS1 MAX_LAYERS<br>+<br> #else<br> #define MAX_LAYERS 1<br> #endif<br>diff --git a/source/x265cli.cpp b/source/x265cli.cpp<br>index c6812459b..9f55b017d 100755<br>--- a/source/x265cli.cpp<br>+++ b/source/x265cli.cpp<br>@@ -1360,6 +1360,7 @@ namespace X265_NS {<br> while (isspace((unsigned char)*argLine)) argLine++;<br> char* start = strchr(argLine, '-');<br> int argCount = 0;<br>+ char flag[] = "true";<br> char** args = (char**)malloc(256 * sizeof(char*));<br> //Adding a dummy string to avoid file parsing error<br> args[argCount++] = (char*)"x265";<br>@@ -1427,7 +1428,7 @@ namespace X265_NS {<br> name = nameBuf;<br> }<br> if (!optarg)<br>- optarg = "true";<br>+ optarg = flag;<br> else if (optarg[0] == '=')<br> optarg++;<br> #define OPT(STR) else if (!strcmp(name, STR))<br>-- <br>2.36.0.windows.1<br><br></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div>