History

avfilter/vf_paletteuse: Fix left shift outside of range of int

by keeping the variable uint32_t which in this situation is the natural type anyway. This affected the FATE-test filter-paletteuse-sierra2_4a.

Andreas Rheinhardt committed 6 years ago

Commit 797c2ec1 parent 55b46901 file · +3 −2Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_paletteuse.c+3−2
@@ -152,9 +152,10 @@ static int query_formats(AVFilterContext *ctx) · 151 unmodified lines
152 return 0;152 return 0;
153}153}
154 154
155static av_always_inline int dither_color(uint32_t px, int er, int eg, int eb, int scale, int shift)155static av_always_inline uint32_t dither_color(uint32_t px, int er, int eg,
156 int eb, int scale, int shift)
156{157{
157 return av_clip_uint8( px >> 24 ) << 24158 return px >> 24 << 24
158 | av_clip_uint8((px >> 16 & 0xff) + ((er * scale) / (1<<shift))) << 16159 | av_clip_uint8((px >> 16 & 0xff) + ((er * scale) / (1<<shift))) << 16
159 | av_clip_uint8((px >> 8 & 0xff) + ((eg * scale) / (1<<shift))) << 8160 | av_clip_uint8((px >> 8 & 0xff) + ((eg * scale) / (1<<shift))) << 8
160 | av_clip_uint8((px & 0xff) + ((eb * scale) / (1<<shift)));161 | av_clip_uint8((px & 0xff) + ((eb * scale) / (1<<shift)));

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