aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_hqx.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-24 02:32:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-24 02:40:50 +0200
commit236aa4de2a103d36b5f3381717150a6780c46697 (patch)
treed9d5445bb08741cb8d0e65e4fe4390d5ddac98d2 /libavfilter/vf_hqx.c
parenteab2509f8ccfaa5c8b61440192b8a6f8305b6541 (diff)
downloadffmpeg-236aa4de2a103d36b5f3381717150a6780c46697.tar.gz
avfilter/vf_hqx: avoid floats
this likely fixes fate failures 2748170880 -> 5389024880 dezicycles Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_hqx.c')
-rw-r--r--libavfilter/vf_hqx.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavfilter/vf_hqx.c b/libavfilter/vf_hqx.c
index ef5a0fae80..e7ed9cfb99 100644
--- a/libavfilter/vf_hqx.c
+++ b/libavfilter/vf_hqx.c
@@ -511,12 +511,12 @@ static av_cold int init(AVFilterContext *ctx)
uint32_t c;
for (c = 0; c < FF_ARRAY_ELEMS(hqx->rgbtoyuv); c++) {
- const uint32_t r = c >> 16 & 0xff;
- const uint32_t g = c >> 8 & 0xff;
- const uint32_t b = c & 0xff;
- const uint32_t y = (uint32_t)( 0.299*r + 0.587*g + 0.114*b);
- const uint32_t u = (uint32_t)(-0.169*r - 0.331*g + 0.5*b) + 128;
- const uint32_t v = (uint32_t)( 0.5*r - 0.419*g - 0.081*b) + 128;
+ const int r = c >> 16 & 0xff;
+ const int g = c >> 8 & 0xff;
+ const int b = c & 0xff;
+ const uint32_t y = (uint32_t)(( 299*r + 587*g + 114*b)/1000);
+ const uint32_t u = (uint32_t)((-169*r - 331*g + 500*b)/1000) + 128;
+ const uint32_t v = (uint32_t)(( 500*r - 419*g - 81*b)/1000) + 128;
hqx->rgbtoyuv[c] = (y << 16) + (u << 8) + v;
}