[FFmpeg-cvslog] avfilter/vf_ciescope: fix black-point position
Paul B Mahol
git at videolan.org
Tue Jan 17 18:51:11 EET 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jan 17 10:45:41 2023 +0100| [d590fbf306a800710065952041885478d5cf0bd3] | committer: Paul B Mahol
avfilter/vf_ciescope: fix black-point position
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d590fbf306a800710065952041885478d5cf0bd3
---
libavfilter/vf_ciescope.c | 34 ++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/libavfilter/vf_ciescope.c b/libavfilter/vf_ciescope.c
index 81a158b14a..1af86f202c 100644
--- a/libavfilter/vf_ciescope.c
+++ b/libavfilter/vf_ciescope.c
@@ -855,8 +855,6 @@ rgb_to_xy(float rc,
*z = m[2][0] * rc + m[2][1] * gc + m[2][2] * bc;
scale = *x + *y + *z;
- if (scale == 0.f)
- scale = 1.f;
scale = 1.f / scale;
*x = *x * scale;
*y = *y * scale;
@@ -1270,11 +1268,11 @@ static void filter_rgb48(AVFilterContext *ctx, const uint8_t *ptr,
float *cx, float *cy, int x, int y)
{
CiescopeContext *s = ctx->priv;
- const float scale = 1. / 65535.;
+ const float scale = 1.f / 65535.f;
const uint16_t *src = (const uint16_t*)(ptr + linesize * y + x * 6);
- float r = src[0] * scale;
- float g = src[1] * scale;
- float b = src[2] * scale;
+ float r = (src[0] + 0.01f) * scale;
+ float g = (src[1] + 0.01f) * scale;
+ float b = (src[2] + 0.01f) * scale;
float cz;
rgb_to_xy(r, g, b, cx, cy, &cz, (const float (*)[3])s->m);
@@ -1285,11 +1283,11 @@ static void filter_rgba64(AVFilterContext *ctx, const uint8_t *ptr,
float *cx, float *cy, int x, int y)
{
CiescopeContext *s = ctx->priv;
- const float scale = 1. / 65535.;
+ const float scale = 1.f / 65535.f;
const uint16_t *src = (const uint16_t*)(ptr + linesize * y + x * 8);
- float r = src[0] * scale;
- float g = src[1] * scale;
- float b = src[2] * scale;
+ float r = (src[0] + 0.01f) * scale;
+ float g = (src[1] + 0.01f) * scale;
+ float b = (src[2] + 0.01f) * scale;
float cz;
rgb_to_xy(r, g, b, cx, cy, &cz, (const float (*)[3])s->m);
@@ -1300,11 +1298,11 @@ static void filter_rgb24(AVFilterContext *ctx, const uint8_t *ptr,
float *cx, float *cy, int x, int y)
{
CiescopeContext *s = ctx->priv;
- const float scale = 1. / 255.;
+ const float scale = 1.f / 255.f;
const uint8_t *src = ptr + linesize * y + x * 3;
- float r = src[0] * scale;
- float g = src[1] * scale;
- float b = src[2] * scale;
+ float r = (src[0] + 0.01f) * scale;
+ float g = (src[1] + 0.01f) * scale;
+ float b = (src[2] + 0.01f) * scale;
float cz;
rgb_to_xy(r, g, b, cx, cy, &cz, (const float (*)[3])s->m);
@@ -1315,11 +1313,11 @@ static void filter_rgba(AVFilterContext *ctx, const uint8_t *ptr,
float *cx, float *cy, int x, int y)
{
CiescopeContext *s = ctx->priv;
- const float scale = 1. / 255.;
+ const float scale = 1.f / 255.f;
const uint8_t *src = ptr + linesize * y + x * 4;
- float r = src[0] * scale;
- float g = src[1] * scale;
- float b = src[2] * scale;
+ float r = (src[0] + 0.01f) * scale;
+ float g = (src[1] + 0.01f) * scale;
+ float b = (src[2] + 0.01f) * scale;
float cz;
rgb_to_xy(r, g, b, cx, cy, &cz, (const float (*)[3])s->m);
More information about the ffmpeg-cvslog
mailing list