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
354 };354 };
355 355
356 /* find prediction - wmv3_dc_scale always used here in fact */356 /* find prediction - wmv3_dc_scale always used here in fact */
357 if (n < 4) scale = s->y_dc_scale;357 scale = s->y_dc_scale;
358 else scale = s->c_dc_scale;
359 358
360 wrap = s->block_wrap[n];359 wrap = s->block_wrap[n];
361 dc_val = s->dc_val[0] + s->block_index[n];360 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
611 *dc_val = dcdiff;610 *dc_val = dcdiff;
612 611
613 /* Store the quantized DC coeff, used for prediction */612 /* Store the quantized DC coeff, used for prediction */
614 if (n < 4)613 block[0] = dcdiff * s->y_dc_scale;
615 scale = s->y_dc_scale;
616 else
617 scale = s->c_dc_scale;
618 block[0] = dcdiff * scale;
619 614
620 ac_val = s->ac_val[0][s->block_index[n]];615 ac_val = s->ac_val[0][s->block_index[n]];
621 ac_val2 = ac_val;616 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
752 *dc_val = dcdiff;747 *dc_val = dcdiff;
753 748
754 /* Store the quantized DC coeff, used for prediction */749 /* Store the quantized DC coeff, used for prediction */
755 if (n < 4)750 block[0] = dcdiff * s->y_dc_scale;
756 scale = s->y_dc_scale;
757 else
758 scale = s->c_dc_scale;
759 block[0] = dcdiff * scale;
760 751
761 /* check if AC is needed at all */752 /* check if AC is needed at all */
762 if (!a_avail && !c_avail)753 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
925 /* XXX: Guard against dumb values of mquant */916 /* XXX: Guard against dumb values of mquant */
926 quant = av_clip_uintp2(quant, 5);917 quant = av_clip_uintp2(quant, 5);
927 918
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 */
929 s->y_dc_scale = s->y_dc_scale_table[quant];920 s->y_dc_scale = s->y_dc_scale_table[quant];
930 s->c_dc_scale = s->c_dc_scale_table[quant];
931 921
932 /* Get DC differential */922 /* Get DC differential */
933 dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_vlc[s->dc_table_index][n >= 4],923 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
949 *dc_val = dcdiff;939 *dc_val = dcdiff;
950 940
951 /* Store the quantized DC coeff, used for prediction */941 /* Store the quantized DC coeff, used for prediction */
952 942 block[0] = dcdiff * s->y_dc_scale;
953 if (n < 4) {
954 block[0] = dcdiff * s->y_dc_scale;
955 } else {
956 block[0] = dcdiff * s->c_dc_scale;
957 }
958 943
959 //AC Decoding944 //AC Decoding
960 i = 1;945 i = 1;
@@ -1593,9 +1578,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 632 unmodified lines
1593 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);1578 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
1594 GET_MQUANT();1579 GET_MQUANT();
1595 s->cur_pic.qscale_table[mb_pos] = mquant;1580 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 */
1597 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];1582 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
1598 s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
1599 dst_idx = 0;1583 dst_idx = 0;
1600 for (i = 0; i < 6; i++) {1584 for (i = 0; i < 6; i++) {
1601 v->a_avail = v->c_avail = 0;1585 v->a_avail = v->c_avail = 0;
@@ -1756,9 +1740,8 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 154 unmodified lines
1756 s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;1740 s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;
1757 GET_MQUANT();1741 GET_MQUANT();
1758 s->cur_pic.qscale_table[mb_pos] = mquant;1742 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 */
1760 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];1744 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
1761 s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
1762 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);1745 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
1763 mb_has_coeffs = idx_mbmode & 1;1746 mb_has_coeffs = idx_mbmode & 1;
1764 if (mb_has_coeffs)1747 if (mb_has_coeffs)
@@ -2044,9 +2027,8 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 279 unmodified lines
2044 s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;2027 s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;
2045 GET_MQUANT();2028 GET_MQUANT();
2046 s->cur_pic.qscale_table[mb_pos] = mquant;2029 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 */
2048 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];2031 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
2049 s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
2050 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);2032 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
2051 mb_has_coeffs = idx_mbmode & 1;2033 mb_has_coeffs = idx_mbmode & 1;
2052 if (mb_has_coeffs)2034 if (mb_has_coeffs)
@@ -2245,9 +2227,8 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 192 unmodified lines
2245 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);2227 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
2246 GET_MQUANT();2228 GET_MQUANT();
2247 s->cur_pic.qscale_table[mb_pos] = mquant;2229 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 */
2249 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];2231 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
2250 s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
2251 dst_idx = 0;2232 dst_idx = 0;
2252 for (i = 0; i < 6; i++) {2233 for (i = 0; i < 6; i++) {
2253 v->a_avail = v->c_avail = 0;2234 v->a_avail = v->c_avail = 0;
@@ -2568,9 +2549,8 @@ static void vc1_decode_i_blocks(VC1Context *v) · 314 unmodified lines
2568 break;2549 break;
2569 }2550 }
2570 2551
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 */
2572 s->y_dc_scale = s->y_dc_scale_table[v->pq];2553 s->y_dc_scale = s->y_dc_scale_table[v->pq];
2573 s->c_dc_scale = s->c_dc_scale_table[v->pq];
2574 2554
2575 //do frame decode2555 //do frame decode
2576 s->mb_x = s->mb_y = 0;2556 s->mb_x = s->mb_y = 0;
@@ -2738,9 +2718,8 @@ static int vc1_decode_i_blocks_adv(VC1Context *v) · 161 unmodified lines
2738 GET_MQUANT();2718 GET_MQUANT();
2739 2719
2740 s->cur_pic.qscale_table[mb_pos] = mquant;2720 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 */
2742 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];2722 s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)];
2743 s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)];
2744 2723
2745 for (k = 0; k < 6; k++) {2724 for (k = 0; k < 6; k++) {
2746 v->mb_type[0][s->block_index[k]] = 1;2725 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
472 return ret;472 return ret;
473 473
474 s->y_dc_scale_table = ff_wmv3_dc_scale_table;474 s->y_dc_scale_table = ff_wmv3_dc_scale_table;
475 s->c_dc_scale_table = ff_wmv3_dc_scale_table;
476 475
477 ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,476 ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
478 ff_wmv1_scantable[1]);477 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