Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-08-27 10:30:36 +0300
committerPaul B Mahol <onemda@gmail.com>2021-08-27 10:35:33 +0300
commit0cacef58facc7509a6d29dd90360d7b28a887760 (patch)
tree9c884baa385ac8be22105a538fb5e950a0810780 /libavfilter/vf_blend.c
parenta6f00d4e82a20354715053b21144bd8c3523db1c (diff)
avfilter/vf_blend: use float for opacity calculations
Diffstat (limited to 'libavfilter/vf_blend.c')
-rw-r--r--libavfilter/vf_blend.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index c968ca8012..84f1e9f5bb 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -147,12 +147,12 @@ static void blend_normal_8bit(const uint8_t *top, ptrdiff_t top_linesize,
ptrdiff_t width, ptrdiff_t height,
FilterParams *param, double *values, int starty)
{
- const double opacity = param->opacity;
+ const float opacity = param->opacity;
int i, j;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
- dst[j] = top[j] * opacity + bottom[j] * (1. - opacity);
+ dst[j] = top[j] * opacity + bottom[j] * (1.f - opacity);
}
dst += dst_linesize;
top += top_linesize;
@@ -169,7 +169,7 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
const uint16_t *top = (uint16_t*)_top;
const uint16_t *bottom = (uint16_t*)_bottom;
uint16_t *dst = (uint16_t*)_dst;
- const double opacity = param->opacity;
+ const float opacity = param->opacity;
int i, j;
dst_linesize /= 2;
top_linesize /= 2;
@@ -177,7 +177,7 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
- dst[j] = top[j] * opacity + bottom[j] * (1. - opacity);
+ dst[j] = top[j] * opacity + bottom[j] * (1.f - opacity);
}
dst += dst_linesize;
top += top_linesize;
@@ -194,7 +194,7 @@ static void blend_normal_32bit(const uint8_t *_top, ptrdiff_t top_linesize,
const float *top = (float*)_top;
const float *bottom = (float*)_bottom;
float *dst = (float*)_dst;
- const double opacity = param->opacity;
+ const float opacity = param->opacity;
int i, j;
dst_linesize /= 4;
top_linesize /= 4;
@@ -202,7 +202,7 @@ static void blend_normal_32bit(const uint8_t *_top, ptrdiff_t top_linesize,
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
- dst[j] = top[j] * opacity + bottom[j] * (1. - opacity);
+ dst[j] = top[j] * opacity + bottom[j] * (1.f - opacity);
}
dst += dst_linesize;
top += top_linesize;
@@ -217,7 +217,7 @@ static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize,
ptrdiff_t width, ptrdiff_t height, \
FilterParams *param, double *values, int starty) \
{ \
- double opacity = param->opacity; \
+ const float opacity = param->opacity; \
int i, j; \
\
for (i = 0; i < height; i++) { \
@@ -240,7 +240,7 @@ static void blend_## name##_##depth##bit(const uint8_t *_top, ptrdiff_t top_line
const uint16_t *top = (const uint16_t*)_top; \
const uint16_t *bottom = (const uint16_t*)_bottom; \
uint16_t *dst = (uint16_t*)_dst; \
- double opacity = param->opacity; \
+ const float opacity = param->opacity; \
int i, j; \
dst_linesize /= 2; \
top_linesize /= 2; \
@@ -266,7 +266,7 @@ static void blend_## name##_##depth##bit(const uint8_t *_top, ptrdiff_t top_line
const float *top = (const float*)_top; \
const float *bottom = (const float*)_bottom; \
float *dst = (float*)_dst; \
- double opacity = param->opacity; \
+ const float opacity = param->opacity; \
int i, j; \
dst_linesize /= 4; \
top_linesize /= 4; \