Commit 76192dcb authored by Loren Merritt's avatar Loren Merritt

allow i4x4 and i8x8 down-left prediction with emulated top-right samples.

based on a patch by Johannes Reinhardt (Johannes dot Reinhardt at uni-konstanz dot de)


git-svn-id: svn://svn.videolan.org/x264/trunk@296 df754926-b1dd-0310-bc7b-ec298dee348c
parent 690a02b1
......@@ -364,23 +364,21 @@ static void predict_8x8chroma_mode_available( unsigned int i_neighbour, int *mod
static void predict_4x4_mode_available( unsigned int i_neighbour,
int *mode, int *pi_count )
{
/* FIXME even when b_tr == 0 there is some case where missing pixels
* are emulated and thus more mode are available TODO
* analysis and encode should be fixed too */
int b_l = i_neighbour & MB_LEFT;
int b_t = i_neighbour & MB_TOP;
int b_tr = i_neighbour & MB_TOPRIGHT;
if( b_l && b_t )
{
*mode++ = I_PRED_4x4_DC;
*mode++ = I_PRED_4x4_H;
*mode++ = I_PRED_4x4_V;
*mode++ = I_PRED_4x4_DDL;
*mode++ = I_PRED_4x4_DDR;
*mode++ = I_PRED_4x4_VR;
*mode++ = I_PRED_4x4_HD;
*mode++ = I_PRED_4x4_VL;
*mode++ = I_PRED_4x4_HU;
*pi_count = 7;
*pi_count = 9;
}
else if( b_l )
{
......@@ -393,20 +391,15 @@ static void predict_4x4_mode_available( unsigned int i_neighbour,
{
*mode++ = I_PRED_4x4_DC_TOP;
*mode++ = I_PRED_4x4_V;
*pi_count = 2;
*mode++ = I_PRED_4x4_DDL;
*mode++ = I_PRED_4x4_VL;
*pi_count = 4;
}
else
{
*mode++ = I_PRED_4x4_DC_128;
*pi_count = 1;
}
if( b_t && b_tr )
{
*mode++ = I_PRED_4x4_DDL;
*mode++ = I_PRED_4x4_VL;
(*pi_count) += 2;
}
}
static void x264_mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a )
......@@ -542,6 +535,11 @@ static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_cost_
i_best = COST_MAX;
predict_4x4_mode_available( h->mb.i_neighbour4[idx], predict_mode, &i_max );
if( (h->mb.i_neighbour4[i] & (MB_TOPRIGHT|MB_TOP)) == MB_TOP )
/* emulate missing topright samples */
*(uint32_t*) &p_dst_by[4 - i_stride] = p_dst_by[3 - i_stride] * 0x01010101U;
for( i = 0; i < i_max; i++ )
{
int i_sad;
......
......@@ -593,6 +593,10 @@ void x264_macroblock_encode( x264_t *h )
uint8_t *p_dst = &h->mb.pic.p_fdec[0][4 * block_idx_x[i] + 4 * block_idx_y[i] * i_dst];
int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[i]];
if( (h->mb.i_neighbour4[i] & (MB_TOPRIGHT|MB_TOP)) == MB_TOP )
/* emulate missing topright samples */
*(uint32_t*) &p_dst[4 - i_dst] = p_dst[3 - i_dst] * 0x01010101U;
h->predict_4x4[i_mode]( p_dst, i_dst );
x264_mb_encode_i4x4( h, i, i_qp );
h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] = x264_mb_pred_mode4x4_fix(i_mode);
......
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