Unified · Split
| @@ -97,15 +97,12 @@ static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, · 96 unmodified lines | ||
| 97 | 97 | cb.size = size; |
| 98 | 98 | for (i = 0; i < size; i++) { |
| 99 | 99 | unsigned mask_bits = get_bits(gb, 4); |
| 100 | − unsigned color0 = get_bits(gb, 15); | |
| 101 | − unsigned color1 = get_bits(gb, 15); | |
| 102 | − | |
| 103 | − for (j = 0; j < 4; j++) { | |
| 104 | − if (mask_bits & (1 << j)) | |
| 105 | − cb.blocks[i].pixels[j] = color1; | |
| 106 | − else | |
| 107 | − cb.blocks[i].pixels[j] = color0; | |
| 108 | − } | |
| 100 | + unsigned color[2]; | |
| 101 | + color[0] = get_bits(gb, 15); | |
| 102 | + color[1] = get_bits(gb, 15); | |
| 103 | + | |
| 104 | + for (j = 0; j < 4; j++) | |
| 105 | + cb.blocks[i].pixels[j] = color[(mask_bits>>j) & 1]; | |
| 109 | 106 | } |
| 110 | 107 | return cb; |
| 111 | 108 | } |