History

avcodec/vc1_block, vc1dec: Don't use c_dc_scale(_table)?

It coincides with the luma values.

Andreas Rheinhardt committed 1 year ago

Commit 8aa08c91 parent 3defca72 files · +11 −33Browse files

Unified · Split

2 files
  1. libavcodec/vc1_block.c +11 −32
  2. libavcodec/vc1dec.c +0 −1
libavcodec/vc1_block.c+11−32
@@ -354,8 +354,7 @@ static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n, · 353 unmodified lines
354354 };
355355
356356 /* find prediction - wmv3_dc_scale always used here in fact */
357− if (n < 4) scale = s->y_dc_scale;
358− else scale = s->c_dc_scale;
357+ scale = s->y_dc_scale;
359358
360359 wrap = s->block_wrap[n];
361360 dc_val = s->dc_val[0] + s->block_index[n];
@@ -611,11 +610,7 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 249 unmodified lines
611610 *dc_val = dcdiff;
612611
613612 /* Store the quantized DC coeff, used for prediction */
614− if (n < 4)
615− scale = s->y_dc_scale;
616− else
617− scale = s->c_dc_scale;
618− block[0] = dcdiff * scale;
613+ block[0] = dcdiff * s->y_dc_scale;
619614
620615 ac_val = s->ac_val[0][s->block_index[n]];
621616 ac_val2 = ac_val;
@@ -752,11 +747,7 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 130 unmodified lines
752747 *dc_val = dcdiff;
753748
754749 /* Store the quantized DC coeff, used for prediction */
755− if (n < 4)
756− scale = s->y_dc_scale;
757− else
758− scale = s->c_dc_scale;
759− block[0] = dcdiff * scale;
750+ block[0] = dcdiff * s->y_dc_scale;
760751
761752 /* check if AC is needed at all */
762753 if (!a_avail && !c_avail)
@@ -925,9 +916,8 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 162 unmodified lines
925916 /* XXX: Guard against dumb values of mquant */
926917 quant = av_clip_uintp2(quant, 5);
927918
928− /* Set DC scale - y and c use the same */
919+ /* Set DC scale - y and c use the same so we only set y */
929920 s->y_dc_scale = s->y_dc_scale_table[quant];
930− s->c_dc_scale = s->c_dc_scale_table[quant];
931921
932922 /* Get DC differential */
933923 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_vlc[s->dc_table_index][n >= 4],
@@ -949,12 +939,7 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 15 unmodified lines
949939 *dc_val = dcdiff;
950940
951941 /* Store the quantized DC coeff, used for prediction */
952−
953− if (n < 4) {
954− block[0] = dcdiff * s->y_dc_scale;
955− } else {
956− block[0] = dcdiff * s->c_dc_scale;
957− }
942+ block[0] = dcdiff * s->y_dc_scale;
958943
959944 //AC Decoding
960945 i = 1;
@@ -1593,9 +1578,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 632 unmodified lines
15931578 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
15941579 GET_MQUANT();
15951580 s->cur_pic.qscale_table[mb_pos] = mquant;
1596− /* Set DC scale - y and c use the same (not sure if necessary here) */
1581+ /* Set DC scale - y and c use the same so we only set y */
15971582 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
1598− s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
15991583 dst_idx = 0;
16001584 for (i = 0; i < 6; i++) {
16011585 v->a_avail = v->c_avail = 0;
@@ -1756,9 +1740,8 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 154 unmodified lines
17561740 s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;
17571741 GET_MQUANT();
17581742 s->cur_pic.qscale_table[mb_pos] = mquant;
1759− /* Set DC scale - y and c use the same (not sure if necessary here) */
1743+ /* Set DC scale - y and c use the same so we only set y */
17601744 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
1761− s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
17621745 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
17631746 mb_has_coeffs = idx_mbmode & 1;
17641747 if (mb_has_coeffs)
@@ -2044,9 +2027,8 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 279 unmodified lines
20442027 s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;
20452028 GET_MQUANT();
20462029 s->cur_pic.qscale_table[mb_pos] = mquant;
2047− /* Set DC scale - y and c use the same (not sure if necessary here) */
2030+ /* Set DC scale - y and c use the same so we only set y */
20482031 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
2049− s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
20502032 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
20512033 mb_has_coeffs = idx_mbmode & 1;
20522034 if (mb_has_coeffs)
@@ -2245,9 +2227,8 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 192 unmodified lines
22452227 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
22462228 GET_MQUANT();
22472229 s->cur_pic.qscale_table[mb_pos] = mquant;
2248− /* Set DC scale - y and c use the same (not sure if necessary here) */
2230+ /* Set DC scale - y and c use the same so we only set y */
22492231 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
2250− s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
22512232 dst_idx = 0;
22522233 for (i = 0; i < 6; i++) {
22532234 v->a_avail = v->c_avail = 0;
@@ -2568,9 +2549,8 @@ static void vc1_decode_i_blocks(VC1Context *v) · 314 unmodified lines
25682549 break;
25692550 }
25702551
2571− /* Set DC scale - y and c use the same */
2552+ /* Set DC scale - y and c use the same so we only set y */
25722553 s->y_dc_scale = s->y_dc_scale_table[v->pq];
2573− s->c_dc_scale = s->c_dc_scale_table[v->pq];
25742554
25752555 //do frame decode
25762556 s->mb_x = s->mb_y = 0;
@@ -2738,9 +2718,8 @@ static int vc1_decode_i_blocks_adv(VC1Context *v) · 161 unmodified lines
27382718 GET_MQUANT();
27392719
27402720 s->cur_pic.qscale_table[mb_pos] = mquant;
2741− /* Set DC scale - y and c use the same */
2721+ /* Set DC scale - y and c use the same so we only set y */
27422722 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
2743− s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
27442723
27452724 for (k = 0; k < 6; k++) {
27462725 v->mb_type[0][s->block_index[k]] = 1;
libavcodec/vc1dec.c+0−1
@@ -472,7 +472,6 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx) · 471 unmodified lines
472472 return ret;
473473
474474 s->y_dc_scale_table = ff_wmv3_dc_scale_table;
475− s->c_dc_scale_table = ff_wmv3_dc_scale_table;
476475
477476 ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
478477 ff_wmv1_scantable[1]);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t