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

Showing the changes to libavcodec (1 of 1 file). Show all

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
585585 GetBitContext *gb = &v->s.gb;
586586 MpegEncContext *s = &v->s;
587587 int dc_pred_dir = 0; /* Direction of the DC prediction used */
588− int i;
589588 int16_t *dc_val;
590589 int16_t *ac_val, *ac_val2;
591590 int dcdiff, scale;
@@ -622,7 +621,6 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 30 unmodified lines
622621 scale = v->pq * 2 + v->halfpq;
623622
624623 //AC Decoding
625− i = !!coded;
626624
627625 if (coded) {
628626 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
637635 } else
638636 zz_table = v->zz_8x8[1];
639637
640− while (!last) {
638+ for (int i = 1; !last; ++i) {
641639 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
642640 if (ret < 0)
643641 return ret;
644642 i += skip;
645643 if (i > 63)
646644 break;
647− block[zz_table[i++]] = value;
645+ block[zz_table[i]] = value;
648646 }
649647
650648 /* 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
696694 }
697695 }
698696 }
699− if (s->ac_pred) i = 63;
700− s->block_last_index[n] = i;
701697
702698 return 0;
703699 }
@@ -716,7 +712,6 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 12 unmodified lines
716712 GetBitContext *gb = &v->s.gb;
717713 MpegEncContext *s = &v->s;
718714 int dc_pred_dir = 0; /* Direction of the DC prediction used */
719− int i;
720715 int16_t *dc_val = NULL;
721716 int16_t *ac_val, *ac_val2;
722717 int dcdiff;
@@ -778,7 +773,6 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 55 unmodified lines
778773 }
779774
780775 //AC Decoding
781− i = 1;
782776
783777 if (coded) {
784778 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
801795 zz_table = v->zzi_8x8;
802796 }
803797
804− while (!last) {
798+ for (int i = 1; !last; ++i) {
805799 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
806800 if (ret < 0)
807801 return ret;
808802 i += skip;
809803 if (i > 63)
810804 break;
811− block[zz_table[i++]] = value;
805+ block[zz_table[i]] = value;
812806 }
813807
814808 /* 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
880874 }
881875 }
882876 }
883− if (use_pred) i = 63;
884− s->block_last_index[n] = i;
885877
886878 return 0;
887879 }
@@ -900,7 +892,6 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 12 unmodified lines
900892 GetBitContext *gb = &v->s.gb;
901893 MpegEncContext *s = &v->s;
902894 int dc_pred_dir = 0; /* Direction of the DC prediction used */
903− int i;
904895 int16_t *dc_val = NULL;
905896 int16_t *ac_val, *ac_val2;
906897 int dcdiff;
@@ -942,7 +933,6 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 35 unmodified lines
942933 block[0] = dcdiff * s->y_dc_scale;
943934
944935 //AC Decoding
945− i = 1;
946936
947937 /* check if AC is needed at all and adjust direction if needed */
948938 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
973963 int last = 0, skip, value;
974964 int k;
975965
976− while (!last) {
966+ for (int i = 1; !last; ++i) {
977967 int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
978968 if (ret < 0)
979969 return ret;
@@ -981,15 +971,15 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 1 unmodified line
981971 if (i > 63)
982972 break;
983973 if (v->fcm == PROGRESSIVE)
984− block[v->zz_8x8[0][i++]] = value;
974+ block[v->zz_8x8[0][i]] = value;
985975 else {
986976 if (use_pred && (v->fcm == ILACE_FRAME)) {
987977 if (!dc_pred_dir) // top
988− block[v->zz_8x8[2][i++]] = value;
978+ block[v->zz_8x8[2][i]] = value;
989979 else // left
990− block[v->zz_8x8[3][i++]] = value;
980+ block[v->zz_8x8[3][i]] = value;
991981 } else {
992− block[v->zzi_8x8[i++]] = value;
982+ block[v->zzi_8x8[i]] = value;
993983 }
994984 }
995985 }
@@ -1033,8 +1023,6 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 37 unmodified lines
10331023 if (!v->pquantizer)
10341024 block[k] += (block[k] < 0) ? -quant : quant;
10351025 }
1036−
1037− if (use_pred) i = 63;
10381026 } else { // no AC coeffs
10391027 int k;
10401028
@@ -1082,10 +1070,8 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 41 unmodified lines
10821070 block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -quant : quant;
10831071 }
10841072 }
1085− i = 63;
10861073 }
10871074 }
1088− s->block_last_index[n] = i;
10891075
10901076 return 0;
10911077 }

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