[x265] [PATCH] sliceype: Bidir cost estimation added to lookahead
deepthidevaki at multicorewareinc.com
deepthidevaki at multicorewareinc.com
Tue Oct 8 08:32:24 CEST 2013
# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1381213898 -19800
# Node ID 8f4428d24e63ae85495597864567071275397db0
# Parent d71078917df01e92605158a13b45ab35ee7cfc1c
sliceype: Bidir cost estimation added to lookahead
diff -r d71078917df0 -r 8f4428d24e63 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp Mon Oct 07 12:48:32 2013 +0530
+++ b/source/encoder/slicetype.cpp Tue Oct 08 12:01:38 2013 +0530
@@ -407,6 +407,28 @@
*fenc_costs[i] = me.motionEstimate(i ? fref1 : fref0, mvmin, mvmax, mvp, numc, mvc, merange, *fenc_mvs[i]);
COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
}
+ if(bBidir)
+ {
+ int hpel = ((*fenc_mvs[0]).y & 2) | (((*fenc_mvs[0]).x & 2) >> 1);
+ pixel *src0 = fref0->lowresPlane[hpel] + pelOffset + ((*fenc_mvs[0]).x >> 2) + ((*fenc_mvs[0]).y >> 2) * fref0->lumaStride;
+ hpel = ((*fenc_mvs[1]).y & 2) | (((*fenc_mvs[1]).x & 2) >> 1);
+ pixel *src1 = fref1->lowresPlane[hpel] + pelOffset + ((*fenc_mvs[1]).x >> 2) + ((*fenc_mvs[1]).y >> 2) * fref1->lumaStride;
+
+ pixel ref[X265_LOWRES_CU_SIZE * X265_LOWRES_CU_SIZE];
+ primitives.pixelavg_pp[PARTITION_8x8](ref, X265_LOWRES_CU_SIZE, src0, fref0->lumaStride, src1, fref1->lumaStride, 0);
+
+ int bicost = primitives.sad[PARTITION_8x8](fenc->lowresPlane[0] + pelOffset, fenc->lumaStride, ref, X265_LOWRES_CU_SIZE);
+ COPY2_IF_LT(bcost, bicost, listused, 3);
+
+ //Try 0,0 candidates
+ src0 = fref0->lowresPlane[0] + pelOffset;
+ src1 = fref1->lowresPlane[0] + pelOffset;
+
+ primitives.pixelavg_pp[PARTITION_8x8](ref, X265_LOWRES_CU_SIZE, src0, fref0->lumaStride, src1, fref1->lumaStride, 0);
+
+ bicost = primitives.sad[PARTITION_8x8](fenc->lowresPlane[0] + pelOffset, fenc->lumaStride, ref, X265_LOWRES_CU_SIZE);
+ COPY2_IF_LT(bcost, bicost, listused, 3);
+ }
}
if (!fenc->bIntraCalculated)
{
More information about the x265-devel
mailing list