<br><br><div class="gmail_quote">On Sun, Jul 4, 2010 at 6:41 PM, <span dir="ltr"><<a href="mailto:git@videolan.org">git@videolan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
x264 | branch: master | Jason Garrett-Glaser <<a href="mailto:darkshikari@gmail.com">darkshikari@gmail.com</a>> | Wed Jun 30 13:06:22 2010 -0700| [f378994ab3c816aaab2b795143e31919fdee1f2d] | committer: Jason Garrett-Glaser<br>
<br>
Don't check i16x16 planar mode unless previous modes were useful<br>
Saves ~160 clocks per MB at subme=1, ~270 per MB at subme>1 (measured on Core i7).<br>
Negligle effect on compression.<br>
<br>
Also make a few more arrays static.<br>
<br>
> <a href="http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=f378994ab3c816aaab2b795143e31919fdee1f2d" target="_blank">http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=f378994ab3c816aaab2b795143e31919fdee1f2d</a><br>
---<br>
<br>
encoder/analyse.c | 29 +++++++++++++++++++----------<br>
encoder/set.c | 3 ++-<br>
2 files changed, 21 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/encoder/analyse.c b/encoder/analyse.c<br>
index 696c78f..cdbdd1e 100644<br>
--- a/encoder/analyse.c<br>
+++ b/encoder/analyse.c<br>
@@ -646,16 +646,27 @@ static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_<br>
/* 16x16 prediction selection */<br>
const int8_t *predict_mode = predict_16x16_mode_available( h->mb.i_neighbour_intra );<br>
<br>
+ /* Not heavily tuned */<br>
+ static const uint8_t i16x16_thresh_lut[11] = { 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4 };<br>
+ int i16x16_thresh = a->b_fast_intra ? (i16x16_thresh_lut[h->mb.i_subpel_refine]*i_satd_inter)>>1 : COST_MAX;<br>
+<br>
if( !h->mb.b_lossless && predict_mode[3] >= 0 )<br>
{<br>
h->pixf.intra_mbcmp_x3_16x16( p_src, p_dst, a->i_satd_i16x16_dir );<br>
- h->predict_16x16[I_PRED_16x16_P]( p_dst );<br>
- a->i_satd_i16x16_dir[I_PRED_16x16_P] =<br>
- h->pixf.mbcmp[PIXEL_16x16]( p_dst, FDEC_STRIDE, p_src, FENC_STRIDE );<br>
- for( int i = 0; i < 4; i++ )<br>
+ a->i_satd_i16x16_dir[0] += lambda * bs_size_ue(0);<br>
+ a->i_satd_i16x16_dir[1] += lambda * bs_size_ue(1);<br>
+ a->i_satd_i16x16_dir[2] += lambda * bs_size_ue(2);<br>
+ COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[0], a->i_predict16x16, 0 );<br>
+ COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[1], a->i_predict16x16, 1 );<br>
+ COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[2], a->i_predict16x16, 2 );<br>
+<br>
+ /* Plane is expensive, so don't check it unless one of the previous modes was useful. */<br>
+ if( a->i_satd_i16x16 <= i16x16_thresh )<br>
{<br>
- int cost = a->i_satd_i16x16_dir[i] += lambda * bs_size_ue(i);<br>
- COPY2_IF_LT( a->i_satd_i16x16, cost, a->i_predict16x16, i );<br>
+ h->predict_16x16[I_PRED_16x16_P]( p_dst );<br>
+ a->i_satd_i16x16_dir[I_PRED_16x16_P] = h->pixf.mbcmp[PIXEL_16x16]( p_dst, FDEC_STRIDE, p_src, FENC_STRIDE );<br>
+ a->i_satd_i16x16_dir[I_PRED_16x16_P] += lambda * bs_size_ue(3);<br>
+ COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[I_PRED_16x16_P], a->i_predict16x16, 3 );<br>
}<br>
}<br>
else<br>
@@ -681,9 +692,7 @@ static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_<br>
/* cavlc mb type prefix */<br>
a->i_satd_i16x16 += lambda * i_mb_b_cost_table[I_16x16];<br>
<br>
- /* Not heavily tuned */<br>
- const uint8_t i16x16_thresh[11] = { 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4 };<br>
- if( a->b_fast_intra && a->i_satd_i16x16 > (i16x16_thresh[h->mb.i_subpel_refine]*i_satd_inter)>>1 )<br>
+ if( a->i_satd_i16x16 > i16x16_thresh )<br></blockquote><div><br></div><div>what the...??</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
return;<br>
<br>
/* 8x8 prediction selection */<br>
@@ -784,7 +793,7 @@ static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_<br>
i_cost = (i_cost * cost_div_fix8[idx]) >> 8;<br>
}<br>
/* Not heavily tuned */<br>
- const uint8_t i8x8_thresh[11] = { 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6 };<br>
+ static const uint8_t i8x8_thresh[11] = { 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6 };<br>
if( X264_MIN(i_cost, a->i_satd_i16x16) > (i_satd_inter*i8x8_thresh[h->mb.i_subpel_refine])>>2 )<br>
return;<br>
}<br>
diff --git a/encoder/set.c b/encoder/set.c<br>
index 8d007aa..8ea6eac 100644<br>
--- a/encoder/set.c<br>
+++ b/encoder/set.c<br>
@@ -534,7 +534,8 @@ int x264_sei_version_write( x264_t *h, bs_t *s )<br>
{<br>
int i;<br>
// random ID number generated according to ISO-11578<br>
- const uint8_t uuid[16] = {<br>
+ static const uint8_t uuid[16] =<br>
+ {<br>
0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7,<br>
0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef<br>
};<br>
<br>
_______________________________________________<br>
x264-devel mailing list<br>
<a href="mailto:x264-devel@videolan.org">x264-devel@videolan.org</a><br>
<a href="http://mailman.videolan.org/listinfo/x264-devel" target="_blank">http://mailman.videolan.org/listinfo/x264-devel</a><br>
</blockquote></div><br>