Commit 50a92488 authored by Loren Merritt's avatar Loren Merritt

Simplify x264_mb_mc_01xywh()


git-svn-id: svn://svn.videolan.org/x264/trunk@125 df754926-b1dd-0310-bc7b-ec298dee348c
parent b2d78b5c
......@@ -613,34 +613,13 @@ static inline void x264_mb_mc_01xywh( x264_t *h, int x, int y, int width, int he
{
const int i8 = x264_scan8[0]+x+8*y;
const int i_ref0 = h->mb.cache.ref[0][i8];
const int mvx0 = x264_clip3( h->mb.cache.mv[0][i8][0], h->mb.mv_min[0], h->mb.mv_max[0] );
const int mvy0 = x264_clip3( h->mb.cache.mv[0][i8][1], h->mb.mv_min[1], h->mb.mv_max[1] );
const int i_ref1 = h->mb.cache.ref[1][i8];
const int mvx1 = x264_clip3( h->mb.cache.mv[1][i8][0], h->mb.mv_min[0], h->mb.mv_max[0] );
const int mvy1 = x264_clip3( h->mb.cache.mv[1][i8][1], h->mb.mv_min[1], h->mb.mv_max[1] );
DECLARE_ALIGNED( uint8_t, tmp[16*16], 16 );
int i_mode = 0;
if( width == 4 && height == 4 ) i_mode = PIXEL_16x16;
else if( width == 4 && height == 2 ) i_mode = PIXEL_16x8;
else if( width == 2 && height == 4 ) i_mode = PIXEL_8x16;
else if( width == 2 && height == 2 ) i_mode = PIXEL_8x8;
else if( width == 2 && height == 1 ) i_mode = PIXEL_8x4;
else if( width == 1 && height == 2 ) i_mode = PIXEL_4x8;
else if( width == 1 && height == 1 ) i_mode = PIXEL_4x4;
h->mc.mc_luma( h->mb.pic.p_fref[0][i_ref0], h->mb.pic.i_stride[0],
&h->mb.pic.p_fdec[0][4*y *h->mb.pic.i_stride[0]+4*x], h->mb.pic.i_stride[0],
mvx0 + 4*4*x, mvy0 + 4*4*y, 4*width, 4*height );
h->mc.mc_chroma( &h->mb.pic.p_fref[0][i_ref0][4][2*y*h->mb.pic.i_stride[1]+2*x], h->mb.pic.i_stride[1],
&h->mb.pic.p_fdec[1][2*y*h->mb.pic.i_stride[1]+2*x], h->mb.pic.i_stride[1],
mvx0, mvy0, 2*width, 2*height );
h->mc.mc_chroma( &h->mb.pic.p_fref[0][i_ref0][5][2*y*h->mb.pic.i_stride[2]+2*x], h->mb.pic.i_stride[2],
&h->mb.pic.p_fdec[2][2*y*h->mb.pic.i_stride[2]+2*x], h->mb.pic.i_stride[2],
mvx0, mvy0, 2*width, 2*height );
int i_mode = x264_size2pixel[height][width];
x264_mb_mc_0xywh( h, x, y, width, height );
h->mc.mc_luma( h->mb.pic.p_fref[1][i_ref1], h->mb.pic.i_stride[0],
tmp, 16, mvx1 + 4*4*x, mvy1 + 4*4*y, 4*width, 4*height );
......@@ -786,13 +765,10 @@ void x264_mb_mc( x264_t *h )
}
else if( h->mb.i_type == B_SKIP || h->mb.i_type == B_DIRECT )
{
int i;
for( i = 0; i < 4; i++ )
{
const int x = 2*(i%2);
const int y = 2*(i/2);
x264_mb_mc_direct8x8( h, x, y );
}
x264_mb_mc_direct8x8( h, 0, 0 );
x264_mb_mc_direct8x8( h, 2, 0 );
x264_mb_mc_direct8x8( h, 0, 2 );
x264_mb_mc_direct8x8( h, 2, 2 );
}
else /* B_*x* */
{
......
......@@ -50,6 +50,14 @@ static const struct {
{ 4, 4 }
};
static const int x264_size2pixel[5][5] = {
{ 0, },
{ 0, PIXEL_4x4, PIXEL_8x4, 0, 0 },
{ 0, PIXEL_4x8, PIXEL_8x8, 0, PIXEL_16x8 },
{ 0, },
{ 0, 0, PIXEL_8x16, 0, PIXEL_16x16 }
};
typedef struct
{
x264_pixel_sad_t sad[7];
......
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