Currently, packed30togbra10() always sets the alpha value to 0xFFFF, without taking the bit depth into consideration. This commit restricts the alpha value to the bit depth.
Unified · Split
| @@ -818,6 +818,7 @@ static void packed30togbra10(const uint8_t *src, int srcStride, · 817 unmodified lines | ||
| 818 | 818 | int x, h, i; |
| 819 | 819 | int dst_alpha = dst[3] != NULL; |
| 820 | 820 | int scale_high = bpc - 10, scale_low = 10 - scale_high; |
| 821 | + uint16_t alpha_val = (1U << bpc) - 1; | |
| 821 | 822 | for (h = 0; h < srcSliceH; h++) { |
| 822 | 823 | uint32_t *src_line = (uint32_t *)(src + srcStride * h); |
| 823 | 824 | unsigned component; |
| @@ -834,7 +835,7 @@ static void packed30togbra10(const uint8_t *src, int srcStride, · 10 unmodified lines | ||
| 834 | 835 | dst[1][x] = av_bswap16(component << scale_high | component >> scale_low); |
| 835 | 836 | component = p & 0x3FF; |
| 836 | 837 | dst[2][x] = av_bswap16(component << scale_high | component >> scale_low); |
| 837 | − dst[3][x] = 0xFFFF; | |
| 838 | + dst[3][x] = av_bswap16(alpha_val); | |
| 838 | 839 | src_line++; |
| 839 | 840 | } |
| 840 | 841 | } else { |
| @@ -860,7 +861,7 @@ static void packed30togbra10(const uint8_t *src, int srcStride, · 19 unmodified lines | ||
| 860 | 861 | dst[1][x] = component << scale_high | component >> scale_low; |
| 861 | 862 | component = p & 0x3FF; |
| 862 | 863 | dst[2][x] = component << scale_high | component >> scale_low; |
| 863 | − dst[3][x] = 0xFFFF; | |
| 864 | + dst[3][x] = alpha_val; | |
| 864 | 865 | src_line++; |
| 865 | 866 | } |
| 866 | 867 | } else { |