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