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