From 55c05293d5812e915252211438b35c06f172e806 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Wed, 7 Oct 2015 19:43:56 +0000 Subject: [PATCH] Revert "rescaler: better handling of the fxy_scale=0 special case." This reverts commit 9f226bf8c3da517c6c671badbb67518ac98b054a. I dropped a 'dst_height' from 'ratio'!! My bad... Change-Id: Id355f0f012a754cddf97012715d69aa5e03c2e5c --- src/utils/rescaler.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/utils/rescaler.c b/src/utils/rescaler.c index a0c5898c..78e26837 100644 --- a/src/utils/rescaler.c +++ b/src/utils/rescaler.c @@ -48,15 +48,9 @@ void WebPRescalerInit(WebPRescaler* const wrk, int src_width, int src_height, wrk->y_sub = wrk->y_expand ? y_sub - 1 : y_sub; wrk->y_accum = wrk->y_expand ? wrk->y_sub : wrk->y_add; if (!wrk->y_expand) { - // this is WEBP_RESCALER_FRAC(1, x_add * y_add) without the cast. - const uint64_t ratio = WEBP_RESCALER_ONE / (wrk->x_add * wrk->y_add); - if (ratio != (uint32_t)ratio) { - // We can't represent the ratio with the current fixed-point precision. - // => We special-case fxy_scale = 0, in WebPRescalerExportRow(). - wrk->fxy_scale = 0; - } else { - wrk->fxy_scale = (uint32_t)ratio; - } + // note the very special case where x_add = y_add = 1 cannot be represented. + // We special-case fxy_scale = 0 in this case, in WebPRescalerExportRow(). + wrk->fxy_scale = WEBP_RESCALER_FRAC(dst_height, wrk->x_add * wrk->y_add); wrk->fy_scale = WEBP_RESCALER_FRAC(1, wrk->y_sub); } else { wrk->fy_scale = WEBP_RESCALER_FRAC(1, wrk->x_add);