Merge weight & offset tables, 15 cpu cycles faster.

Originally committed as revision 22169 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2010-03-03 14:41:43 +00:00
parent 72f86ec013
commit 70118abd68
3 changed files with 27 additions and 29 deletions

View File

@ -495,14 +495,14 @@ static inline void mc_part_weighted(H264Context *h, int n, int square, int chrom
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, 5, weight0, weight1, 0); chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, 5, weight0, weight1, 0);
}else{ }else{
luma_weight_avg(dest_y, tmp_y, h->mb_linesize, h->luma_log2_weight_denom, luma_weight_avg(dest_y, tmp_y, h->mb_linesize, h->luma_log2_weight_denom,
h->luma_weight[0][refn0], h->luma_weight[1][refn1], h->luma_weight[0][refn0][0], h->luma_weight[1][refn1][0],
h->luma_offset[0][refn0] + h->luma_offset[1][refn1]); h->luma_weight[0][refn0][1] + h->luma_weight[1][refn1][1]);
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom, chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom,
h->chroma_weight[0][refn0][0], h->chroma_weight[1][refn1][0], h->chroma_weight[0][refn0][0][0], h->chroma_weight[1][refn1][0][0],
h->chroma_offset[0][refn0][0] + h->chroma_offset[1][refn1][0]); h->chroma_weight[0][refn0][0][1] + h->chroma_weight[1][refn1][0][1]);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom, chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom,
h->chroma_weight[0][refn0][1], h->chroma_weight[1][refn1][1], h->chroma_weight[0][refn0][1][0], h->chroma_weight[1][refn1][1][0],
h->chroma_offset[0][refn0][1] + h->chroma_offset[1][refn1][1]); h->chroma_weight[0][refn0][1][1] + h->chroma_weight[1][refn1][1][1]);
} }
}else{ }else{
int list = list1 ? 1 : 0; int list = list1 ? 1 : 0;
@ -513,12 +513,12 @@ static inline void mc_part_weighted(H264Context *h, int n, int square, int chrom
qpix_put, chroma_put); qpix_put, chroma_put);
luma_weight_op(dest_y, h->mb_linesize, h->luma_log2_weight_denom, luma_weight_op(dest_y, h->mb_linesize, h->luma_log2_weight_denom,
h->luma_weight[list][refn], h->luma_offset[list][refn]); h->luma_weight[list][refn][0], h->luma_weight[list][refn][1]);
if(h->use_weight_chroma){ if(h->use_weight_chroma){
chroma_weight_op(dest_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom, chroma_weight_op(dest_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom,
h->chroma_weight[list][refn][0], h->chroma_offset[list][refn][0]); h->chroma_weight[list][refn][0][0], h->chroma_weight[list][refn][0][1]);
chroma_weight_op(dest_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom, chroma_weight_op(dest_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom,
h->chroma_weight[list][refn][1], h->chroma_offset[list][refn][1]); h->chroma_weight[list][refn][1][0], h->chroma_weight[list][refn][1][1]);
} }
} }
} }
@ -1368,16 +1368,16 @@ static int pred_weight_table(H264Context *h){
luma_weight_flag= get_bits1(&s->gb); luma_weight_flag= get_bits1(&s->gb);
if(luma_weight_flag){ if(luma_weight_flag){
h->luma_weight[list][i]= get_se_golomb(&s->gb); h->luma_weight[list][i][0]= get_se_golomb(&s->gb);
h->luma_offset[list][i]= get_se_golomb(&s->gb); h->luma_weight[list][i][1]= get_se_golomb(&s->gb);
if( h->luma_weight[list][i] != luma_def if( h->luma_weight[list][i][0] != luma_def
|| h->luma_offset[list][i] != 0) { || h->luma_weight[list][i][1] != 0) {
h->use_weight= 1; h->use_weight= 1;
h->luma_weight_flag[list]= 1; h->luma_weight_flag[list]= 1;
} }
}else{ }else{
h->luma_weight[list][i]= luma_def; h->luma_weight[list][i][0]= luma_def;
h->luma_offset[list][i]= 0; h->luma_weight[list][i][1]= 0;
} }
if(CHROMA){ if(CHROMA){
@ -1385,10 +1385,10 @@ static int pred_weight_table(H264Context *h){
if(chroma_weight_flag){ if(chroma_weight_flag){
int j; int j;
for(j=0; j<2; j++){ for(j=0; j<2; j++){
h->chroma_weight[list][i][j]= get_se_golomb(&s->gb); h->chroma_weight[list][i][j][0]= get_se_golomb(&s->gb);
h->chroma_offset[list][i][j]= get_se_golomb(&s->gb); h->chroma_weight[list][i][j][1]= get_se_golomb(&s->gb);
if( h->chroma_weight[list][i][j] != chroma_def if( h->chroma_weight[list][i][j][0] != chroma_def
|| h->chroma_offset[list][i][j] != 0) { || h->chroma_weight[list][i][j][1] != 0) {
h->use_weight_chroma= 1; h->use_weight_chroma= 1;
h->chroma_weight_flag[list]= 1; h->chroma_weight_flag[list]= 1;
} }
@ -1396,8 +1396,8 @@ static int pred_weight_table(H264Context *h){
}else{ }else{
int j; int j;
for(j=0; j<2; j++){ for(j=0; j<2; j++){
h->chroma_weight[list][i][j]= chroma_def; h->chroma_weight[list][i][j][0]= chroma_def;
h->chroma_offset[list][i][j]= 0; h->chroma_weight[list][i][j][1]= 0;
} }
} }
} }

View File

@ -417,10 +417,8 @@ typedef struct H264Context{
int use_weight_chroma; int use_weight_chroma;
int luma_log2_weight_denom; int luma_log2_weight_denom;
int chroma_log2_weight_denom; int chroma_log2_weight_denom;
int luma_weight[2][48]; int luma_weight[2][48][2];
int luma_offset[2][48]; int chroma_weight[2][48][2][2];
int chroma_weight[2][48][2];
int chroma_offset[2][48][2];
int implicit_weight[48][48]; int implicit_weight[48][48];
//deblock //deblock

View File

@ -315,11 +315,11 @@ void ff_h264_fill_mbaff_ref_list(H264Context *h){
field[1].reference = PICT_BOTTOM_FIELD; field[1].reference = PICT_BOTTOM_FIELD;
field[1].poc= field[1].field_poc[1]; field[1].poc= field[1].field_poc[1];
h->luma_weight[list][16+2*i] = h->luma_weight[list][16+2*i+1] = h->luma_weight[list][i]; h->luma_weight[list][16+2*i][0] = h->luma_weight[list][16+2*i+1][0] = h->luma_weight[list][i][0];
h->luma_offset[list][16+2*i] = h->luma_offset[list][16+2*i+1] = h->luma_offset[list][i]; h->luma_weight[list][16+2*i][1] = h->luma_weight[list][16+2*i+1][1] = h->luma_weight[list][i][1];
for(j=0; j<2; j++){ for(j=0; j<2; j++){
h->chroma_weight[list][16+2*i][j] = h->chroma_weight[list][16+2*i+1][j] = h->chroma_weight[list][i][j]; h->chroma_weight[list][16+2*i][j][0] = h->chroma_weight[list][16+2*i+1][j][0] = h->chroma_weight[list][i][j][0];
h->chroma_offset[list][16+2*i][j] = h->chroma_offset[list][16+2*i+1][j] = h->chroma_offset[list][i][j]; h->chroma_weight[list][16+2*i][j][1] = h->chroma_weight[list][16+2*i+1][j][1] = h->chroma_weight[list][i][j][1];
} }
} }
} }