<div dir="ltr"><div><div>There are a couple of warnings our regression tests caught with this. Can you take a look?<br><br>source\encoder\predict.cpp(78): warning C4800: 'const unsigned char' : forcing value to bool 'true' or 'false' (performance warning)<br>
</div>(IntraFilterType can be bool, I think?).<br><br><br>C:\users\deepthi\code\x265\source\encoder\slicetype.cpp(1714): warning C4701: potentially uninitialized local variable 'lowmode' used<br><br></div><div><div>
Thanks,<br>Deepthi<br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 13, 2014 at 4:07 AM, <span dir="ltr"><<a href="mailto:dtyx265@gmail.com" target="_blank">dtyx265@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User David T Yuen <<a href="mailto:dtyx265@gmail.com">dtyx265@gmail.com</a>><br>
# Date 1407882999 25200<br>
# Node ID 75e4ad481b3668b1e420ede300287aa3ea3fb8d5<br>
# Parent 8a7f4bb1d1be32fe668d410450c2e320ccae6098<br>
Added fast intra search option<br>
<br>
This version calls intra_pred_allangs to create the predictions then the faster search with satd<br>
<br>
diff -r 8a7f4bb1d1be -r 75e4ad481b36 source/common/param.cpp<br>
--- a/source/common/param.cpp Tue Aug 12 01:11:39 2014 -0500<br>
+++ b/source/common/param.cpp Tue Aug 12 15:36:39 2014 -0700<br>
@@ -132,6 +132,7 @@<br>
/* Intra Coding Tools */<br>
param->bEnableConstrainedIntra = 0;<br>
param->bEnableStrongIntraSmoothing = 1;<br>
+ param->bEnableFastIntra = 0;<br>
<br>
/* Inter Coding tools */<br>
param->searchMethod = X265_HEX_SEARCH;<br>
@@ -560,6 +561,7 @@<br>
OPT("lossless") p->bLossless = atobool(value);<br>
OPT("cu-lossless") p->bCULossless = atobool(value);<br>
OPT("constrained-intra") p->bEnableConstrainedIntra = atobool(value);<br>
+ OPT("fast-intra") p->bEnableFastIntra = atobool(value);<br>
OPT("open-gop") p->bOpenGOP = atobool(value);<br>
OPT("scenecut")<br>
{<br>
@@ -1211,6 +1213,7 @@<br>
BOOL(p->bLossless, "lossless");<br>
BOOL(p->bCULossless, "cu-lossless");<br>
BOOL(p->bEnableConstrainedIntra, "constrained-intra");<br>
+ BOOL(p->bEnableFastIntra, "fast-intra");<br>
BOOL(p->bOpenGOP, "open-gop");<br>
s += sprintf(s, " interlace=%d", p->interlaceMode);<br>
s += sprintf(s, " keyint=%d", p->keyframeMax);<br>
diff -r 8a7f4bb1d1be -r 75e4ad481b36 source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp Tue Aug 12 01:11:39 2014 -0500<br>
+++ b/source/encoder/slicetype.cpp Tue Aug 12 15:36:39 2014 -0700<br>
@@ -1242,6 +1242,7 @@<br>
{<br>
m_rows[i].m_widthInCU = m_widthInCU;<br>
m_rows[i].m_heightInCU = m_heightInCU;<br>
+ m_rows[i].m_param = m_param;<br>
}<br>
<br>
if (!WaveFront::init(m_heightInCU))<br>
@@ -1676,26 +1677,86 @@<br>
<br>
int predsize = cuSize * cuSize;<br>
<br>
- // generate 35 intra predictions into tmp<br>
+ // generate 35 intra predictions into m_predictions<br>
+ pixelcmp_t satd = primitives.satd[partitionFromLog2Size(X265_LOWRES_CU_BITS)];<br>
+ int icost = m_me.COST_MAX, cost, highcost, lowcost, acost = m_me.COST_MAX;<br>
+ uint32_t lowmode, mode;<br>
primitives.intra_pred[sizeIdx][DC_IDX](m_predictions, cuSize, left0, above0, 0, (cuSize <= 16));<br>
+ cost = satd(m_me.fenc, FENC_STRIDE, m_predictions, cuSize);<br>
+ if (cost < icost)<br>
+ icost = cost;<br>
pixel *above = (cuSize >= 8) ? above1 : above0;<br>
pixel *left = (cuSize >= 8) ? left1 : left0;<br>
- primitives.intra_pred[sizeIdx][PLANAR_IDX](m_predictions + predsize, cuSize, left, above, 0, 0);<br>
+ primitives.intra_pred[sizeIdx][PLANAR_IDX](m_predictions, cuSize, left, above, 0, 0);<br>
+ cost = satd(m_me.fenc, FENC_STRIDE, m_predictions, cuSize);<br>
+ if (cost < icost)<br>
+ icost = cost;<br>
primitives.intra_pred_allangs[sizeIdx](m_predictions + 2 * predsize, above0, left0, above1, left1, (cuSize <= 16));<br>
<br>
- // calculate 35 satd costs, keep least cost<br>
+ // calculate satd costs, keep least cost<br>
ALIGN_VAR_32(pixel, buf_trans[32 * 32]);<br>
primitives.transpose[sizeIdx](buf_trans, m_me.fenc, FENC_STRIDE);<br>
- pixelcmp_t satd = primitives.satd[partitionFromLog2Size(X265_LOWRES_CU_BITS)];<br>
- int icost = m_me.COST_MAX, cost;<br>
- for (uint32_t mode = 0; mode < 35; mode++)<br>
+ // fast-intra angle search<br>
+ if (m_param->bEnableFastIntra)<br>
{<br>
- if ((mode >= 2) && (mode < 18))<br>
+ for (mode = 4;mode < 35; mode += 5)<br>
+ {<br>
+ if (mode < 18)<br>
+ cost = satd(buf_trans, cuSize, &m_predictions[mode * predsize], cuSize);<br>
+ else<br>
+ cost = satd(m_me.fenc, FENC_STRIDE, &m_predictions[mode * predsize], cuSize);<br>
+ if (cost < acost)<br>
+ {<br>
+ lowmode = mode;<br>
+ acost = cost;<br>
+ }<br>
+ }<br>
+ mode = lowmode - 2;<br>
+ if (mode < 18)<br>
+ lowcost = satd(buf_trans, cuSize, &m_predictions[mode * predsize], cuSize);<br>
+ else<br>
+ lowcost = satd(m_me.fenc, FENC_STRIDE, &m_predictions[mode * predsize], cuSize);<br>
+ highcost = m_me.COST_MAX;<br>
+ if (lowmode < 34)<br>
+ {<br>
+ mode = lowmode + 2;<br>
+ if (mode < 18)<br>
+ highcost = satd(buf_trans, cuSize, &m_predictions[mode * predsize], cuSize);<br>
+ else<br>
+ highcost = satd(m_me.fenc, FENC_STRIDE, &m_predictions[mode * predsize], cuSize);<br>
+ }<br>
+ if (lowcost <= highcost)<br>
+ {<br>
+ mode = lowmode - 1;<br>
+ if (lowcost < acost)<br>
+ acost = lowcost;<br>
+ }<br>
+ else<br>
+ {<br>
+ mode = lowmode + 1;<br>
+ if (highcost < acost)<br>
+ acost = highcost;<br>
+ }<br>
+ if (mode < 18)<br>
cost = satd(buf_trans, cuSize, &m_predictions[mode * predsize], cuSize);<br>
else<br>
cost = satd(m_me.fenc, FENC_STRIDE, &m_predictions[mode * predsize], cuSize);<br>
- if (cost < icost)<br>
- icost = cost;<br>
+ if (cost < acost)<br>
+ acost = cost;<br>
+ if (acost < icost)<br>
+ icost = acost;<br>
+ }<br>
+ else // calculate and search all intra prediction angles for lowest cost<br>
+ {<br>
+ for (mode = 2; mode < 35; mode++)<br>
+ {<br>
+ if (mode < 18)<br>
+ cost = satd(buf_trans, cuSize, &m_predictions[mode * predsize], cuSize);<br>
+ else<br>
+ cost = satd(m_me.fenc, FENC_STRIDE, &m_predictions[mode * predsize], cuSize);<br>
+ if (cost < icost)<br>
+ icost = cost;<br>
+ }<br>
}<br>
const int intraPenalty = 5 * m_lookAheadLambda;<br>
icost += intraPenalty + lowresPenalty;<br>
diff -r 8a7f4bb1d1be -r 75e4ad481b36 source/encoder/slicetype.h<br>
--- a/source/encoder/slicetype.h Tue Aug 12 01:11:39 2014 -0500<br>
+++ b/source/encoder/slicetype.h Tue Aug 12 15:36:39 2014 -0700<br>
@@ -48,6 +48,7 @@<br>
class EstimateRow<br>
{<br>
public:<br>
+ x265_param* m_param;<br>
MotionEstimate m_me;<br>
Lock m_lock;<br>
pixel* m_predictions; // buffer for 35 intra predictions<br>
diff -r 8a7f4bb1d1be -r 75e4ad481b36 source/x265.cpp<br>
--- a/source/x265.cpp Tue Aug 12 01:11:39 2014 -0500<br>
+++ b/source/x265.cpp Tue Aug 12 15:36:39 2014 -0700<br>
@@ -117,6 +117,8 @@<br>
{ "no-cu-lossless", no_argument, NULL, 0 },<br>
{ "no-constrained-intra", no_argument, NULL, 0 },<br>
{ "constrained-intra", no_argument, NULL, 0 },<br>
+ { "fast-intra", no_argument, NULL, 0 },<br>
+ { "no-fast-intra", no_argument, NULL, 0 },<br>
{ "no-open-gop", no_argument, NULL, 0 },<br>
{ "open-gop", no_argument, NULL, 0 },<br>
{ "keyint", required_argument, NULL, 'I' },<br>
@@ -387,6 +389,7 @@<br>
H0(" --[no-]strong-intra-smoothing Enable strong intra smoothing for 32x32 blocks. Default %s\n", OPT(param->bEnableStrongIntraSmoothing));<br>
H0(" --[no-]constrained-intra Constrained intra prediction (use only intra coded reference pixels) Default %s\n", OPT(param->bEnableConstrainedIntra));<br>
H0(" --[no-]b-intra Enable intra in B frames in veryslow presets. Default %s\n", OPT(param->bIntraInBFrames));<br>
+ H0(" --[no]-fast-intra Enable faster search method for intra mode. Default %s\n", OPT(param->bEnableFastIntra));<br>
H0(" --rdpenalty <0..2> penalty for 32x32 intra TU in non-I slices. 0:disabled 1:RD-penalty 2:maximum. Default %d\n", param->rdPenalty);<br>
H0("\nSlice decision options:\n");<br>
H0(" --[no-]open-gop Enable open-GOP, allows I slices to be non-IDR. Default %s\n", OPT(param->bOpenGOP));<br>
diff -r 8a7f4bb1d1be -r 75e4ad481b36 source/x265.h<br>
--- a/source/x265.h Tue Aug 12 01:11:39 2014 -0500<br>
+++ b/source/x265.h Tue Aug 12 15:36:39 2014 -0700<br>
@@ -533,6 +533,9 @@<br>
* depending on your source material. Defaults to disabled */<br>
int bEnableStrongIntraSmoothing;<br>
<br>
+ /* Use a faster search method to find the best intra mode. Default is 0 */<br>
+ int bEnableFastIntra;<br>
+<br>
/*== Inter Coding Tools ==*/<br>
<br>
/* ME search method (DIA, HEX, UMH, STAR, FULL). The search patterns<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>