History

avcodec/vc1_block: Stop setting write-only block_last_index

It is only used by the mpegvideo unquantize functions which this decoder does not use at all.

Andreas Rheinhardt committed 1 year ago

Commit 1a564c11 parent 594b97e1 file · +9 −23Browse files

Unified · Split

libavcodec/vc1_block.c+9−23
@@ -585,7 +585,6 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 584 unmodified lines
585 GetBitContext *gb = &v->s.gb;585 GetBitContext *gb = &v->s.gb;
586 MpegEncContext *s = &v->s;586 MpegEncContext *s = &v->s;
587 int dc_pred_dir = 0; /* Direction of the DC prediction used */587 int dc_pred_dir = 0; /* Direction of the DC prediction used */
588 int i;
589 int16_t *dc_val;588 int16_t *dc_val;
590 int16_t *ac_val, *ac_val2;589 int16_t *ac_val, *ac_val2;
591 int dcdiff, scale;590 int dcdiff, scale;
@@ -622,7 +621,6 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 30 unmodified lines
622 scale = v->pq * 2 + v->halfpq;621 scale = v->pq * 2 + v->halfpq;
623 622
624 //AC Decoding623 //AC Decoding
625 i = !!coded;
626 624
627 if (coded) {625 if (coded) {
628 int last = 0, skip, value;626 int last = 0, skip, value;
@@ -637,14 +635,14 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 8 unmodified lines
637 } else635 } else
638 zz_table = v->zz_8x8[1];636 zz_table = v->zz_8x8[1];
639 637
640 while (!last) {638 for (int i = 1; !last; ++i) {
641 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);639 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
642 if (ret < 0)640 if (ret < 0)
643 return ret;641 return ret;
644 i += skip;642 i += skip;
645 if (i > 63)643 if (i > 63)
646 break;644 break;
647 block[zz_table[i++]] = value;645 block[zz_table[i]] = value;
648 }646 }
649 647
650 /* apply AC prediction if needed */648 /* apply AC prediction if needed */
@@ -696,8 +694,6 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 45 unmodified lines
696 }694 }
697 }695 }
698 }696 }
699 if (s->ac_pred) i = 63;
700 s->block_last_index[n] = i;
701 697
702 return 0;698 return 0;
703}699}
@@ -716,7 +712,6 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 12 unmodified lines
716 GetBitContext *gb = &v->s.gb;712 GetBitContext *gb = &v->s.gb;
717 MpegEncContext *s = &v->s;713 MpegEncContext *s = &v->s;
718 int dc_pred_dir = 0; /* Direction of the DC prediction used */714 int dc_pred_dir = 0; /* Direction of the DC prediction used */
719 int i;
720 int16_t *dc_val = NULL;715 int16_t *dc_val = NULL;
721 int16_t *ac_val, *ac_val2;716 int16_t *ac_val, *ac_val2;
722 int dcdiff;717 int dcdiff;
@@ -778,7 +773,6 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 55 unmodified lines
778 }773 }
779 774
780 //AC Decoding775 //AC Decoding
781 i = 1;
782 776
783 if (coded) {777 if (coded) {
784 int last = 0, skip, value;778 int last = 0, skip, value;
@@ -801,14 +795,14 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 16 unmodified lines
801 zz_table = v->zzi_8x8;795 zz_table = v->zzi_8x8;
802 }796 }
803 797
804 while (!last) {798 for (int i = 1; !last; ++i) {
805 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);799 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
806 if (ret < 0)800 if (ret < 0)
807 return ret;801 return ret;
808 i += skip;802 i += skip;
809 if (i > 63)803 if (i > 63)
810 break;804 break;
811 block[zz_table[i++]] = value;805 block[zz_table[i]] = value;
812 }806 }
813 807
814 /* apply AC prediction if needed */808 /* apply AC prediction if needed */
@@ -880,8 +874,6 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 65 unmodified lines
880 }874 }
881 }875 }
882 }876 }
883 if (use_pred) i = 63;
884 s->block_last_index[n] = i;
885 877
886 return 0;878 return 0;
887}879}
@@ -900,7 +892,6 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 12 unmodified lines
900 GetBitContext *gb = &v->s.gb;892 GetBitContext *gb = &v->s.gb;
901 MpegEncContext *s = &v->s;893 MpegEncContext *s = &v->s;
902 int dc_pred_dir = 0; /* Direction of the DC prediction used */894 int dc_pred_dir = 0; /* Direction of the DC prediction used */
903 int i;
904 int16_t *dc_val = NULL;895 int16_t *dc_val = NULL;
905 int16_t *ac_val, *ac_val2;896 int16_t *ac_val, *ac_val2;
906 int dcdiff;897 int dcdiff;
@@ -942,7 +933,6 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 35 unmodified lines
942 block[0] = dcdiff * s->y_dc_scale;933 block[0] = dcdiff * s->y_dc_scale;
943 934
944 //AC Decoding935 //AC Decoding
945 i = 1;
946 936
947 /* check if AC is needed at all and adjust direction if needed */937 /* check if AC is needed at all and adjust direction if needed */
948 if (!a_avail) dc_pred_dir = 1;938 if (!a_avail) dc_pred_dir = 1;
@@ -973,7 +963,7 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 24 unmodified lines
973 int last = 0, skip, value;963 int last = 0, skip, value;
974 int k;964 int k;
975 965
976 while (!last) {966 for (int i = 1; !last; ++i) {
977 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);967 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
978 if (ret < 0)968 if (ret < 0)
979 return ret;969 return ret;
@@ -981,15 +971,15 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 1 unmodified line
981 if (i > 63)971 if (i > 63)
982 break;972 break;
983 if (v->fcm == PROGRESSIVE)973 if (v->fcm == PROGRESSIVE)
984 block[v->zz_8x8[0][i++]] = value;974 block[v->zz_8x8[0][i]] = value;
985 else {975 else {
986 if (use_pred && (v->fcm == ILACE_FRAME)) {976 if (use_pred && (v->fcm == ILACE_FRAME)) {
987 if (!dc_pred_dir) // top977 if (!dc_pred_dir) // top
988 block[v->zz_8x8[2][i++]] = value;978 block[v->zz_8x8[2][i]] = value;
989 else // left979 else // left
990 block[v->zz_8x8[3][i++]] = value;980 block[v->zz_8x8[3][i]] = value;
991 } else {981 } else {
992 block[v->zzi_8x8[i++]] = value;982 block[v->zzi_8x8[i]] = value;
993 }983 }
994 }984 }
995 }985 }
@@ -1033,8 +1023,6 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 37 unmodified lines
1033 if (!v->pquantizer)1023 if (!v->pquantizer)
1034 block[k] += (block[k] < 0) ? -quant : quant;1024 block[k] += (block[k] < 0) ? -quant : quant;
1035 }1025 }
1036
1037 if (use_pred) i = 63;
1038 } else { // no AC coeffs1026 } else { // no AC coeffs
1039 int k;1027 int k;
1040 1028
@@ -1082,10 +1070,8 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 41 unmodified lines
1082 block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -quant : quant;1070 block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -quant : quant;
1083 }1071 }
1084 }1072 }
1085 i = 63;
1086 }1073 }
1087 }1074 }
1088 s->block_last_index[n] = i;
1089 1075
1090 return 0;1076 return 0;
1091}1077}

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