|
|
|
@ -212,6 +212,7 @@ static void av_always_inline h264_filter_mb_fast_internal( H264Context *h, int m |
|
|
|
|
MpegEncContext * const s = &h->s; |
|
|
|
|
int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); |
|
|
|
|
int chroma444 = CHROMA444; |
|
|
|
|
int chroma422 = CHROMA422; |
|
|
|
|
|
|
|
|
|
int mb_xy = h->mb_xy; |
|
|
|
|
int left_type= h->left_type[LTOP]; |
|
|
|
@ -289,6 +290,23 @@ static void av_always_inline h264_filter_mb_fast_internal( H264Context *h, int m |
|
|
|
|
filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
} |
|
|
|
|
}else if(chroma422){ |
|
|
|
|
if(left_type){ |
|
|
|
|
filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); |
|
|
|
|
filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); |
|
|
|
|
} |
|
|
|
|
filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
if(top_type){ |
|
|
|
|
filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); |
|
|
|
|
filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); |
|
|
|
|
} |
|
|
|
|
filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); |
|
|
|
|
}else{ |
|
|
|
|
if(left_type){ |
|
|
|
|
filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); |
|
|
|
@ -411,10 +429,12 @@ static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ |
|
|
|
|
return v; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int a, int b, int chroma, int chroma444, int dir) { |
|
|
|
|
static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int a, int b, int chroma, int dir) { |
|
|
|
|
MpegEncContext * const s = &h->s; |
|
|
|
|
int edge; |
|
|
|
|
int chroma_qp_avg[2]; |
|
|
|
|
int chroma444 = CHROMA444; |
|
|
|
|
int chroma422 = CHROMA422; |
|
|
|
|
const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy; |
|
|
|
|
const int mbm_type = dir == 0 ? h->left_type[LTOP] : h->top_type; |
|
|
|
|
|
|
|
|
@ -564,8 +584,9 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u |
|
|
|
|
for( edge = 1; edge < edges; edge++ ) { |
|
|
|
|
DECLARE_ALIGNED(8, int16_t, bS)[4]; |
|
|
|
|
int qp; |
|
|
|
|
const int deblock_edge = !IS_8x8DCT(mb_type & (edge<<24)); // (edge&1) && IS_8x8DCT(mb_type)
|
|
|
|
|
|
|
|
|
|
if( IS_8x8DCT(mb_type & (edge<<24)) ) // (edge&1) && IS_8x8DCT(mb_type)
|
|
|
|
|
if (!deblock_edge && (!chroma422 || dir == 0)) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
if( IS_INTRA(mb_type)) { |
|
|
|
@ -627,14 +648,23 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
filter_mb_edgeh( &img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0 ); |
|
|
|
|
if (chroma) { |
|
|
|
|
if (chroma444) { |
|
|
|
|
filter_mb_edgeh ( &img_cb[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); |
|
|
|
|
filter_mb_edgeh ( &img_cr[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); |
|
|
|
|
} else if( (edge&1) == 0 ) { |
|
|
|
|
filter_mb_edgech( &img_cb[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); |
|
|
|
|
filter_mb_edgech( &img_cr[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); |
|
|
|
|
if (chroma422) { |
|
|
|
|
if (deblock_edge) |
|
|
|
|
filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0); |
|
|
|
|
if (chroma) { |
|
|
|
|
filter_mb_edgech(&img_cb[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cr[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0); |
|
|
|
|
if (chroma) { |
|
|
|
|
if (chroma444) { |
|
|
|
|
filter_mb_edgeh (&img_cb[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); |
|
|
|
|
filter_mb_edgeh (&img_cr[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); |
|
|
|
|
} else if ((edge&1) == 0) { |
|
|
|
|
filter_mb_edgech(&img_cb[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); |
|
|
|
|
filter_mb_edgech(&img_cr[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -726,6 +756,11 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint |
|
|
|
|
filter_mb_mbaff_edgev ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1 ); |
|
|
|
|
filter_mb_mbaff_edgev ( h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1 ); |
|
|
|
|
filter_mb_mbaff_edgev ( h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1], a, b, 1 ); |
|
|
|
|
} else if (CHROMA422) { |
|
|
|
|
filter_mb_mbaff_edgecv(h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1); |
|
|
|
|
filter_mb_mbaff_edgecv(h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1); |
|
|
|
|
filter_mb_mbaff_edgecv(h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1); |
|
|
|
|
filter_mb_mbaff_edgecv(h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1], a, b, 1); |
|
|
|
|
}else{ |
|
|
|
|
filter_mb_mbaff_edgecv( h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1 ); |
|
|
|
|
filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1 ); |
|
|
|
@ -754,9 +789,9 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint |
|
|
|
|
|
|
|
|
|
#if CONFIG_SMALL |
|
|
|
|
for( dir = 0; dir < 2; dir++ ) |
|
|
|
|
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, a, b, chroma, CHROMA444, dir); |
|
|
|
|
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, a, b, chroma, dir); |
|
|
|
|
#else |
|
|
|
|
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, a, b, chroma, CHROMA444, 0); |
|
|
|
|
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, a, b, chroma, CHROMA444, 1); |
|
|
|
|
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, a, b, chroma, 0); |
|
|
|
|
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, a, b, chroma, 1); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|