Commit e46db685 authored by Loren Merritt's avatar Loren Merritt

cosmetics


git-svn-id: svn://svn.videolan.org/x264/trunk@245 df754926-b1dd-0310-bc7b-ec298dee348c
parent 7f988086
......@@ -328,6 +328,8 @@ struct x264_t
unsigned int i_neighbour;
int i_mb_type_top;
int i_mb_type_left;
int i_mb_type_topleft;
int i_mb_type_topright;
/* mb table */
int8_t *type; /* mb type */
......
......@@ -921,7 +921,8 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
const int i_mb_4x4 = 4*(i_mb_y * h->mb.i_b4_stride + i_mb_x);
const int i_mb_8x8 = 2*(i_mb_y * h->mb.i_b8_stride + i_mb_x);
int i_top_xy = -1;
int i_mb_xy = i_mb_y * h->mb.i_mb_stride + i_mb_x;
int i_top_xy = i_mb_xy - h->mb.i_mb_stride;
int i_left_xy = -1;
int i_top_type = -1; /* gcc warn */
int i_left_type= -1;
......@@ -931,7 +932,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
/* init index */
h->mb.i_mb_x = i_mb_x;
h->mb.i_mb_y = i_mb_y;
h->mb.i_mb_xy = i_mb_y * h->mb.i_mb_stride + i_mb_x;
h->mb.i_mb_xy = i_mb_xy;
h->mb.i_b8_xy = i_mb_8x8;
h->mb.i_b4_xy = i_mb_4x4;
h->mb.i_neighbour = 0;
......@@ -961,9 +962,8 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
}
/* load cache */
if( h->mb.i_mb_xy >= h->sh.i_first_mb + h->mb.i_mb_stride )
if( i_mb_xy >= h->sh.i_first_mb + h->mb.i_mb_stride )
{
i_top_xy = h->mb.i_mb_xy - h->mb.i_mb_stride;
h->mb.i_mb_type_top =
i_top_type= h->mb.type[i_top_xy];
......@@ -1009,11 +1009,11 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
}
if( i_mb_x > 0 && h->mb.i_mb_xy > h->sh.i_first_mb )
if( i_mb_x > 0 && i_mb_xy > h->sh.i_first_mb )
{
i_left_xy = h->mb.i_mb_xy - 1;
i_left_xy = i_mb_xy - 1;
h->mb.i_mb_type_left =
i_left_type= h->mb.type[i_left_xy];
i_left_type = h->mb.type[i_left_xy];
h->mb.i_neighbour |= MB_LEFT;
......@@ -1055,10 +1055,20 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
h->mb.cache.non_zero_count[x264_scan8[16+4+2] - 1] = 0x80;
}
if( i_mb_x < h->sps->i_mb_width - 1 && h->mb.i_mb_xy >= h->sh.i_first_mb + h->mb.i_mb_stride - 1 )
if( i_mb_x < h->sps->i_mb_width - 1 && i_top_xy + 1 >= h->sh.i_first_mb )
{
h->mb.i_neighbour |= MB_TOPRIGHT;
if( i_mb_x > 0 && h->mb.i_mb_xy >= h->sh.i_first_mb + h->mb.i_mb_stride + 1 )
h->mb.i_mb_type_topright = h->mb.type[ i_top_xy + 1 ];
}
else
h->mb.i_mb_type_topright = -1;
if( i_mb_x > 0 && i_top_xy - 1 >= h->sh.i_first_mb )
{
h->mb.i_neighbour |= MB_TOPLEFT;
h->mb.i_mb_type_topleft = h->mb.type[ i_top_xy - 1 ];
}
else
h->mb.i_mb_type_topleft = -1;
/* load ref/mv/mvd */
if( h->sh.i_type != SLICE_TYPE_I )
......@@ -1093,7 +1103,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
h->mb.cache.mv[i_list][i8][1] = 0;
}
if( i_top_xy >= 0 )
if( h->mb.i_neighbour & MB_TOP )
{
const int i8 = x264_scan8[0] - 8;
const int ir = i_mb_8x8 - s8x8;
......@@ -1139,7 +1149,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
h->mb.cache.mv[i_list][i8][1] = 0;
}
if( i_left_xy >= 0 )
if( h->mb.i_neighbour & MB_LEFT )
{
const int i8 = x264_scan8[0] - 1;
const int ir = i_mb_8x8 - 1;
......@@ -1169,7 +1179,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
if( h->param.b_cabac )
{
if( i_top_xy >= 0 )
if( i_top_type >= 0 )
{
const int i8 = x264_scan8[0] - 8;
const int iv = i_mb_4x4 - s4x4;
......@@ -1189,7 +1199,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
}
}
if( i_left_xy >= 0 )
if( i_left_type >= 0 )
{
const int i8 = x264_scan8[0] - 1;
const int iv = i_mb_4x4 - 1;
......@@ -1215,12 +1225,12 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
if( h->sh.i_type == SLICE_TYPE_B && h->param.b_cabac )
{
memset( h->mb.cache.skip, 0, X264_SCAN8_SIZE * sizeof( int8_t ) );
if( i_left_xy >= 0 )
if( i_left_type >= 0 )
{
h->mb.cache.skip[x264_scan8[0] - 1] = h->mb.skipbp[i_left_xy] & 0x2;
h->mb.cache.skip[x264_scan8[8] - 1] = h->mb.skipbp[i_left_xy] & 0x8;
}
if( i_top_xy >= 0 )
if( i_top_type >= 0 )
{
h->mb.cache.skip[x264_scan8[0] - 8] = h->mb.skipbp[i_top_xy] & 0x4;
h->mb.cache.skip[x264_scan8[4] - 8] = h->mb.skipbp[i_top_xy] & 0x8;
......
......@@ -239,11 +239,10 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp )
/* Fast intra decision */
if( h->mb.i_mb_xy - h->sh.i_first_mb > 4 )
{
const unsigned int i_neighbour = h->mb.i_neighbour;
if( ((i_neighbour&MB_LEFT) && IS_INTRA( h->mb.type[h->mb.i_mb_xy - 1] ))
|| ((i_neighbour&MB_TOP) && IS_INTRA( h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride] ))
|| (((i_neighbour&(MB_TOP|MB_LEFT)) == (MB_TOP|MB_LEFT)) && IS_INTRA( h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride-1 ] ))
|| ((i_neighbour&MB_TOPRIGHT) && IS_INTRA( h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride+1 ] ))
if( IS_INTRA( h->mb.i_mb_type_left )
|| IS_INTRA( h->mb.i_mb_type_top )
|| IS_INTRA( h->mb.i_mb_type_topleft )
|| IS_INTRA( h->mb.i_mb_type_topright )
|| (h->sh.i_type == SLICE_TYPE_P && IS_INTRA( h->fref0[0]->mb_type[h->mb.i_mb_xy] ))
|| (h->mb.i_mb_xy - h->sh.i_first_mb < 3*(h->stat.frame.i_mb_count[I_4x4] + h->stat.frame.i_mb_count[I_16x16])) )
{ /* intra is likely */ }
......@@ -263,7 +262,7 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp )
/* Max = 4 */
static void predict_16x16_mode_available( unsigned int i_neighbour, int *mode, int *pi_count )
{
if( ( i_neighbour & (MB_LEFT|MB_TOP) ) == (MB_LEFT|MB_TOP) )
if( i_neighbour & MB_TOPLEFT )
{
/* top and left avaible */
*mode++ = I_PRED_16x16_V;
......@@ -272,14 +271,14 @@ static void predict_16x16_mode_available( unsigned int i_neighbour, int *mode, i
*mode++ = I_PRED_16x16_P;
*pi_count = 4;
}
else if( ( i_neighbour & MB_LEFT ) )
else if( i_neighbour & MB_LEFT )
{
/* left available*/
*mode++ = I_PRED_16x16_DC_LEFT;
*mode++ = I_PRED_16x16_H;
*pi_count = 2;
}
else if( ( i_neighbour & MB_TOP ) )
else if( i_neighbour & MB_TOP )
{
/* top available*/
*mode++ = I_PRED_16x16_DC_TOP;
......@@ -297,7 +296,7 @@ static void predict_16x16_mode_available( unsigned int i_neighbour, int *mode, i
/* Max = 4 */
static void predict_8x8_mode_available( unsigned int i_neighbour, int *mode, int *pi_count )
{
if( ( i_neighbour & (MB_LEFT|MB_TOP) ) == (MB_LEFT|MB_TOP) )
if( i_neighbour & MB_TOPLEFT )
{
/* top and left avaible */
*mode++ = I_PRED_CHROMA_V;
......@@ -306,14 +305,14 @@ static void predict_8x8_mode_available( unsigned int i_neighbour, int *mode, int
*mode++ = I_PRED_CHROMA_P;
*pi_count = 4;
}
else if( ( i_neighbour & MB_LEFT ) )
else if( i_neighbour & MB_LEFT )
{
/* left available*/
*mode++ = I_PRED_CHROMA_DC_LEFT;
*mode++ = I_PRED_CHROMA_H;
*pi_count = 2;
}
else if( ( i_neighbour & MB_TOP ) )
else if( i_neighbour & MB_TOP )
{
/* top available*/
*mode++ = I_PRED_CHROMA_DC_TOP;
......@@ -1326,17 +1325,15 @@ void x264_macroblock_analyse( x264_t *h )
}
else if( h->sh.i_type == SLICE_TYPE_P )
{
const unsigned int i_neighbour = h->mb.i_neighbour;
int b_skip = 0;
int i_cost;
int i_intra_cost, i_intra_type;
/* Fast P_SKIP detection */
if( ( (i_neighbour&MB_LEFT) && h->mb.type[h->mb.i_mb_xy - 1] == P_SKIP ) ||
( (i_neighbour&MB_TOP) && h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride] == P_SKIP ) ||
( ((i_neighbour&(MB_TOP|MB_LEFT)) == (MB_TOP|MB_LEFT) ) && h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride-1 ] == P_SKIP ) ||
( (i_neighbour&MB_TOPRIGHT) && h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride+1 ] == P_SKIP ) )
if( ( h->mb.i_mb_type_left == P_SKIP ) ||
( h->mb.i_mb_type_top == P_SKIP ) ||
( h->mb.i_mb_type_topleft == P_SKIP ) ||
( h->mb.i_mb_type_topright == P_SKIP ) )
{
b_skip = x264_macroblock_probe_pskip( h );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment