summaryrefslogtreecommitdiff
path: root/libavfilter/vf_paletteuse.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-08-19 09:40:14 +0200
committerPaul B Mahol <onemda@gmail.com>2021-08-19 09:45:09 +0200
commit79934cc702fe1c90bfb58bb83ab20490b9d86e37 (patch)
treead67157335b4635341dab36f4d8e1462dbb4728c /libavfilter/vf_paletteuse.c
parent6d09de90d1a1544e47c959de58189df30de9cda8 (diff)
avfilter/vf_paletteuse: do not use in dithering transparent palette
Diffstat (limited to 'libavfilter/vf_paletteuse.c')
-rw-r--r--libavfilter/vf_paletteuse.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 4b2144c6f9..1de6a67738 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -380,9 +380,13 @@ static av_always_inline int get_dst_color_err(PaletteUseContext *s,
if (dstx < 0)
return dstx;
dstc = s->palette[dstx];
- *er = (int)r - (int)(dstc >> 16 & 0xff);
- *eg = (int)g - (int)(dstc >> 8 & 0xff);
- *eb = (int)b - (int)(dstc & 0xff);
+ if (dstx == s->transparency_index) {
+ *er = *eg = *eb = 0;
+ } else {
+ *er = (int)r - (int)(dstc >> 16 & 0xff);
+ *eg = (int)g - (int)(dstc >> 8 & 0xff);
+ *eb = (int)b - (int)(dstc & 0xff);
+ }
return dstx;
}