+struct MotionData
+{
+ MV mv;
+ MV mvp;
+ int mvpIdx;
+ int ref;
+ uint32_t cost;
+ int bits;
+ bool costZero;
+};
+
+struct Mode
+{
+ CUData cu;
+ const Yuv* fencYuv;
+ Yuv predYuv;
+ Yuv reconYuv;
+ Entropy contexts;
+
+ enum { MAX_INTER_PARTS = 2 };
+
+ MotionData bestME[MAX_INTER_PARTS][2];
+ MV amvpCand[2][MAX_NUM_REF][AMVP_NUM_CANDS];
+
+ uint64_t rdCost; // sum of partition (psy) RD costs (sse(fenc, recon) + lambda2 * bits)
+ uint64_t sa8dCost; // sum of partition sa8d distortion costs (sa8d(fenc, pred) + lambda * bits)
+ uint32_t sa8dBits; // signal bits used in sa8dCost calculation
+ uint32_t psyEnergy; // sum of partition psycho-visual energy difference
+ uint32_t distortion; // sum of partition SSE distortion
+ uint32_t totalBits; // sum of partition bits (mv + coeff)
+ uint32_t mvBits; // Mv bits + Ref + block type (or intra mode)
+ uint32_t coeffBits; // Texture bits (DCT Coeffs)
+
+ void initCosts()
+ {
+ rdCost = 0;
+ sa8dCost = 0;
+ sa8dBits = 0;
+ psyEnergy = 0;
+ distortion = 0;
+ totalBits = 0;
+ mvBits = 0;
+ coeffBits = 0;
+ }
+
+ void addSubCosts(const Mode& subMode)
+ {
+ rdCost += subMode.rdCost;
+ sa8dCost += subMode.sa8dCost;
+ sa8dBits += subMode.sa8dBits;
+ psyEnergy += subMode.psyEnergy;
+ distortion += subMode.distortion;
+ totalBits += subMode.totalBits;
+ mvBits += subMode.mvBits;
+ coeffBits += subMode.coeffBits;
+ }
+};
+