Skip to content

Commit 66ac26e

Browse files
MSVC: reverse the order of the rows for each 4x4 block
Fixes #9650.
1 parent 4b0a1c4 commit 66ac26e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

components/scifio/src/loci/formats/codec/MSVideoCodec.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ else if (b >= 0 && b < 0x80) {
138138

139139
for (int y=0; y<4; y++) {
140140
for (int x=3; x>=0; x--) {
141-
int ndx = options.width*(column + y) + row + x;
141+
int ndx = options.width*(column + (3 - y)) + row + x;
142142
short flag = y < 2 ? b : a;
143143
int shift = 4 - 4*(y % 2) + x;
144144
int cmp = 1 << shift;
@@ -163,8 +163,8 @@ else if (b >= 0 && b < 0x80) {
163163
short q4b = in.readShort();
164164

165165
for (int y=0; y<4; y++) {
166-
for (int x=3; x>= 0; x--) {
167-
int ndx = options.width*(column + y) + row + x;
166+
for (int x=3; x>=0; x--) {
167+
int ndx = options.width*(column + (3 - y)) + row + x;
168168

169169
short colorA =
170170
x < 2 ? (y < 2 ? q3a : q1a) : (y < 2 ? q4a : q2a);
@@ -189,7 +189,7 @@ else if (b >= 0 && b < 0x80) {
189189

190190
for (int y=0; y<4; y++) {
191191
for (int x=3; x>=0; x--) {
192-
int ndx = options.width*(column + y) + row + x;
192+
int ndx = options.width*(column + (3 - y)) + row + x;
193193
if (ndx >= shorts.length) break;
194194
short flag = y < 2 ? b : a;
195195
int shift = 4 - 4*(y % 2) + x;
@@ -213,7 +213,7 @@ else if (options.bitsPerSample == 8 && 0x90 < b) {
213213

214214
for (int y=0; y<4; y++) {
215215
for (int x=3; x>=0; x--) {
216-
int ndx = options.width*(column + y) + row + x;
216+
int ndx = options.width*(column + (3 - y)) + row + x;
217217
byte colorA = y < 2 ? (x < 2 ? colors[4] : colors[6]) :
218218
(x < 2 ? colors[0] : colors[2]);
219219
byte colorB = y < 2 ? (x < 2 ? colors[5] : colors[7]) :
@@ -236,7 +236,7 @@ else if (options.bitsPerSample == 8 && 0x90 < b) {
236236
else {
237237
for (int y=0; y<4; y++) {
238238
for (int x=0; x<4; x++) {
239-
int ndx = options.width*(column + y) + row + x;
239+
int ndx = options.width*(column + (3 - y)) + row + x;
240240
if (options.bitsPerSample == 8) {
241241
if (ndx < bytes.length) {
242242
bytes[ndx] = (byte) (a & 0xff);

0 commit comments

Comments
 (0)