History

avfilter/vf_overlay: improve premultiplied alpha overlay for YUV

Paul B Mahol committed 4 years ago

Commit bdf01a91 parent 987d2c11 file · +3 −2Browse files

Unified · Split

libavfilter/vf_overlay.c+3−2
@@ -538,12 +538,13 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext · 537 unmodified lines
538538 if (i && yuv) \
539539 *d = av_clip((*d * (max - alpha) + *s * alpha) / max + *s - mid, -mid, mid) + mid; \
540540 else \
541− *d = FFMIN((*d * (max - alpha) + *s * alpha) / max + *s, max); \
541+ *d = av_clip_uintp2((*d * (max - alpha) + *s * alpha) / max + *s - (16<<(nbits-8)),\
542+ nbits);\
542543 } else { \
543544 if (i && yuv) \
544545 *d = av_clip(FAST_DIV255((*d - mid) * (max - alpha)) + *s - mid, -mid, mid) + mid; \
545546 else \
546− *d = FFMIN(FAST_DIV255(*d * (max - alpha)) + *s, max); \
547+ *d = av_clip_uint8(FAST_DIV255(*d * (255 - alpha)) + *s - 16); \
547548 } \
548549 } \
549550 s++; \

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