History

swscale/swscale_unscaled: fix packed30togbra10() for formats with bpc between 9-14 bits

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.

Ramiro Polla committed 1 year ago

Commit 0c1d87d1 parent a16c0531 file · +3 −2Browse files

Unified · Split

libswscale/swscale_unscaled.c+3−2
@@ -818,6 +818,7 @@ static void packed30togbra10(const uint8_t *src, int srcStride, · 817 unmodified lines
818818 int x, h, i;
819819 int dst_alpha = dst[3] != NULL;
820820 int scale_high = bpc - 10, scale_low = 10 - scale_high;
821+ uint16_t alpha_val = (1U << bpc) - 1;
821822 for (h = 0; h < srcSliceH; h++) {
822823 uint32_t *src_line = (uint32_t *)(src + srcStride * h);
823824 unsigned component;
@@ -834,7 +835,7 @@ static void packed30togbra10(const uint8_t *src, int srcStride, · 10 unmodified lines
834835 dst[1][x] = av_bswap16(component << scale_high | component >> scale_low);
835836 component = p & 0x3FF;
836837 dst[2][x] = av_bswap16(component << scale_high | component >> scale_low);
837− dst[3][x] = 0xFFFF;
838+ dst[3][x] = av_bswap16(alpha_val);
838839 src_line++;
839840 }
840841 } else {
@@ -860,7 +861,7 @@ static void packed30togbra10(const uint8_t *src, int srcStride, · 19 unmodified lines
860861 dst[1][x] = component << scale_high | component >> scale_low;
861862 component = p & 0x3FF;
862863 dst[2][x] = component << scale_high | component >> scale_low;
863− dst[3][x] = 0xFFFF;
864+ dst[3][x] = alpha_val;
864865 src_line++;
865866 }
866867 } else {

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