aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2006-11-26 04:52:36 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2006-11-26 04:52:36 +0000
commit25e9c7efa597b8a4bfdbd68283adb59e86ffad89 (patch)
treeff3a562b4c2530b61faaca980fbf97f73ef3bd45 /libavcodec
parent167de74f103aee6cd41c3d87a53d15e3614910e3 (diff)
downloadffmpeg-25e9c7efa597b8a4bfdbd68283adb59e86ffad89.tar.gz
Use halfpq in coefficient scaling
Originally committed as revision 7168 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vc1.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 94a1f112ea..1d991df16c 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -2843,8 +2843,8 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
if(use_pred) {
/* scale predictors if needed*/
if(q2 && q1!=q2) {
- q1 = q1 * 2 - 1;
- q2 = q2 * 2 - 1;
+ q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
+ q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
@@ -2886,8 +2886,8 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
if(use_pred) {
memcpy(ac_val2, ac_val, 8 * 2);
if(q2 && q1!=q2) {
- q1 = q1 * 2 - 1;
- q2 = q2 * 2 - 1;
+ q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
+ q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
@@ -2896,8 +2896,8 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
if(use_pred) {
memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
if(q2 && q1!=q2) {
- q1 = q1 * 2 - 1;
- q2 = q2 * 2 - 1;
+ q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
+ q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k + 8] = (ac_val2[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
@@ -3042,8 +3042,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
if(use_pred) {
/* scale predictors if needed*/
if(q2 && q1!=q2) {
- q1 = q1 * 2 - 1;
- q2 = q2 * 2 - 1;
+ q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
+ q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
@@ -3085,8 +3085,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
if(use_pred) {
memcpy(ac_val2, ac_val, 8 * 2);
if(q2 && q1!=q2) {
- q1 = q1 * 2 - 1;
- q2 = q2 * 2 - 1;
+ q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
+ q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
@@ -3095,8 +3095,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
if(use_pred) {
memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
if(q2 && q1!=q2) {
- q1 = q1 * 2 - 1;
- q2 = q2 * 2 - 1;
+ q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
+ q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k + 8] = (ac_val2[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}