X-Git-Url: https://git.piment-noir.org/?p=deb_x265.git;a=blobdiff_plain;f=source%2Fencoder%2Fanalysis.h;fp=source%2Fencoder%2Fanalysis.h;h=aff7d6665e0d4e77f3c1e523d834b7873224bd8e;hp=404cc90e0129e4168920da17428164bd74e8d00f;hb=b53f7c52d8280ab63876efd6eb292c21430ac607;hpb=5c9b45285dd64723ad1dac380b98a7b1f3095674 diff --git a/source/encoder/analysis.h b/source/encoder/analysis.h index 404cc90..aff7d66 100644 --- a/source/encoder/analysis.h +++ b/source/encoder/analysis.h @@ -49,6 +49,7 @@ public: PRED_SKIP, PRED_INTRA, PRED_2Nx2N, + PRED_BIDIR, PRED_Nx2N, PRED_2NxN, PRED_SPLIT, @@ -71,11 +72,15 @@ public: ModeDepth m_modeDepth[NUM_CU_DEPTH]; bool m_bTryLossless; + bool m_bChromaSa8d; + /* Analysis data for load/save modes, keeps getting incremented as CTU analysis proceeds and data is consumed or read */ + analysis_intra_data* m_reuseIntraDataCTU; + analysis_inter_data* m_reuseInterDataCTU; Analysis(); bool create(ThreadLocalData* tld); void destroy(); - Search::Mode& compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, const Entropy& initialContext); + Mode& compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, const Entropy& initialContext); protected: @@ -83,13 +88,14 @@ protected: int m_totalNumJobs; volatile int m_numAcquiredJobs; volatile int m_numCompletedJobs; + Lock m_pmodeLock; Event m_modeCompletionEvent; bool findJob(int threadId); void parallelModeAnalysis(int threadId, int jobId); void parallelME(int threadId, int meId); /* full analysis for an I-slice CU */ - void compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, x265_intra_data* sdata, uint32_t &zOrder); + void compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, uint32_t &zOrder); /* full analysis for a P or B slice CU */ void compressInterCU_dist(const CUData& parentCTU, const CUGeom& cuGeom); @@ -104,20 +110,36 @@ protected: void checkInter_rd0_4(Mode& interMode, const CUGeom& cuGeom, PartSize partSize); void checkInter_rd5_6(Mode& interMode, const CUGeom& cuGeom, PartSize partSize, bool bMergeOnly); - /* measure intra options */ - void checkIntraInInter_rd0_4(Mode& intraMode, const CUGeom& cuGeom); - void encodeIntraInInter(Mode& intraMode, const CUGeom& cuGeom); + void checkBidir2Nx2N(Mode& inter2Nx2N, Mode& bidir2Nx2N, const CUGeom& cuGeom); /* encode current bestMode losslessly, pick best RD cost */ void tryLossless(const CUGeom& cuGeom); - void checkDQP(CUData& cu, const CUGeom& cuGeom); + /* add the RD cost of coding a split flag (0 or 1) to the given mode */ void addSplitFlagCost(Mode& mode, uint32_t depth); - void checkBestMode(Mode& mode, uint32_t depth); + + /* update CBF flags and QP values to be internally consistent */ + void checkDQP(CUData& cu, const CUGeom& cuGeom); + + /* work-avoidance heuristics for RD levels < 5 */ uint32_t topSkipMinDepth(const CUData& parentCTU, const CUGeom& cuGeom); bool recursionDepthCheck(const CUData& parentCTU, const CUGeom& cuGeom, const Mode& bestMode); + /* generate residual and recon pixels for an entire CTU recursively (RD0) */ void encodeResidue(const CUData& parentCTU, const CUGeom& cuGeom); + + /* check whether current mode is the new best */ + inline void checkBestMode(Mode& mode, uint32_t depth) + { + ModeDepth& md = m_modeDepth[depth]; + if (md.bestMode) + { + if (mode.rdCost < md.bestMode->rdCost) + md.bestMode = &mode; + } + else + md.bestMode = &mode; + } }; struct ThreadLocalData