1000l: scale DC predictors instead of predicted value.

Originally committed as revision 5808 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Kostya Shishkov 2006-07-21 04:06:06 +00:00
parent 92ad0d9d3b
commit 27ed1a0dee

View File

@ -1769,38 +1769,46 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
c = dc_val[ - 1]; c = dc_val[ - 1];
b = dc_val[ - 1 - wrap]; b = dc_val[ - 1 - wrap];
a = dc_val[ - wrap]; a = dc_val[ - wrap];
/* scale predictors if needed */
q1 = s->current_picture.qscale_table[mb_pos];
if(c_avail && (n!= 1 && n!=3)) {
q2 = s->current_picture.qscale_table[mb_pos - 1];
if(q2 && q2 != q1)
c = (c * s->y_dc_scale_table[q2] * vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
if(a_avail && (n!= 2 && n!=3)) {
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
if(q2 && q2 != q1)
a = (a * s->y_dc_scale_table[q2] * vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
if(a_avail && c_avail && (n!=3)) {
int off = mb_pos;
if(n != 1) off--;
if(n != 2) off -= s->mb_stride;
q2 = s->current_picture.qscale_table[off];
if(q2 && q2 != q1)
b = (b * s->y_dc_scale_table[q2] * vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
if(a_avail && c_avail) { if(a_avail && c_avail) {
if(abs(a - b) <= abs(b - c)) { if(abs(a - b) <= abs(b - c)) {
pred = c; pred = c;
*dir_ptr = 1;//left *dir_ptr = 1;//left
q2 = s->current_picture.qscale_table[mb_pos - 1];
} else { } else {
pred = a; pred = a;
*dir_ptr = 0;//top *dir_ptr = 0;//top
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
} }
} else if(a_avail) { } else if(a_avail) {
pred = a; pred = a;
*dir_ptr = 0;//top *dir_ptr = 0;//top
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
} else if(c_avail) { } else if(c_avail) {
pred = c; pred = c;
*dir_ptr = 1;//left *dir_ptr = 1;//left
q2 = s->current_picture.qscale_table[mb_pos - 1];
} else { } else {
pred = 0; pred = 0;
*dir_ptr = 1;//left *dir_ptr = 1;//left
} }
/* scale coeffs if needed */
q1 = s->current_picture.qscale_table[mb_pos];
if(n && n<4) q2=q1;
if(q2 && q1!=q2) {
pred = (pred * s->y_dc_scale_table[q2] * vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
/* update predictor */ /* update predictor */
*dc_val_ptr = &dc_val[0]; *dc_val_ptr = &dc_val[0];
return pred; return pred;