diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-11-01 19:34:30 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-11-01 19:34:30 +0000 |
commit | 65342b2b4a1f3baf705a1794593e778e92621dc6 (patch) | |
tree | 5b2e6b918beab60fcca56d8601f8689525e0946c /libavcodec/h264.c | |
parent | a512446ed33e68bf22d7245d60ebc911df72e647 (diff) | |
download | ffmpeg-65342b2b4a1f3baf705a1794593e778e92621dc6.tar.gz |
merge clip() into the alpha/beta/tc0 tables (10% faster filter_mb_fast() on P3)
Originally committed as revision 6863 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 440c254bf2..67754fb5ec 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -6739,14 +6739,14 @@ decode_intra_mb: static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i, d; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] : -1; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] : -1; h->s.dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc); } else { /* 16px edge length, because bS=4 is triggered by being at @@ -6800,14 +6800,14 @@ static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int16_t b } static void filter_mb_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] + 1 : 0; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] + 1 : 0; h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta); @@ -6833,12 +6833,12 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int } qp_index = MB_FIELD ? (i >> 3) : (i & 1); - index_a = clip( qp[qp_index] + h->slice_alpha_c0_offset, 0, 51 ); - alpha = alpha_table[index_a]; - beta = beta_table[clip( qp[qp_index] + h->slice_beta_offset, 0, 51 )]; + index_a = qp[qp_index] + h->slice_alpha_c0_offset; + alpha = (alpha_table+52)[index_a]; + beta = (beta_table+52)[qp[qp_index] + h->slice_beta_offset]; if( bS[bS_index] < 4 ) { - const int tc0 = tc0_table[index_a][bS[bS_index] - 1]; + const int tc0 = (tc0_table+52)[index_a][bS[bS_index] - 1]; const int p0 = pix[-1]; const int p1 = pix[-2]; const int p2 = pix[-3]; @@ -6927,12 +6927,12 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in } qp_index = MB_FIELD ? (i >> 2) : (i & 1); - index_a = clip( qp[qp_index] + h->slice_alpha_c0_offset, 0, 51 ); - alpha = alpha_table[index_a]; - beta = beta_table[clip( qp[qp_index] + h->slice_beta_offset, 0, 51 )]; + index_a = qp[qp_index] + h->slice_alpha_c0_offset; + alpha = (alpha_table+52)[index_a]; + beta = (beta_table+52)[qp[qp_index] + h->slice_beta_offset]; if( bS[bS_index] < 4 ) { - const int tc = tc0_table[index_a][bS[bS_index] - 1] + 1; + const int tc = (tc0_table+52)[index_a][bS[bS_index] - 1] + 1; const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; @@ -6967,15 +6967,15 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i, d; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; const int pix_next = stride; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] : -1; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] : -1; h->s.dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc); } else { /* 16px edge length, see filter_mb_edgev */ @@ -7027,14 +7027,14 @@ static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t b static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] + 1 : 0; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] + 1 : 0; h->s.dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->s.dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); |