[x264-devel] commit: Fix resize filter rounding code (James Darnley )
git at videolan.org
git at videolan.org
Mon Nov 22 16:06:24 CET 2010
x264 | branch: master | James Darnley <james.darnley at gmail.com> | Sun Nov 21 10:50:48 2010 +0100| [8eaf8a66d5d8a5c55155feee293150f9fb0eba0e] | committer: Jason Garrett-Glaser
Fix resize filter rounding code
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=8eaf8a66d5d8a5c55155feee293150f9fb0eba0e
---
filters/video/resize.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/filters/video/resize.c b/filters/video/resize.c
index 04b5e73..aec53e1 100644
--- a/filters/video/resize.c
+++ b/filters/video/resize.c
@@ -205,10 +205,10 @@ static int pick_closest_supported_csp( int csp )
static int round_dbl( double val, int precision, int b_truncate )
{
- int ret = (int)(val / precision) * precision;
- if( !b_truncate && (val - ret) >= (precision/2) ) // use the remainder if we're not truncating it
- ret += precision;
- return ret;
+ if( b_truncate )
+ return trunc(val / precision) * precision;
+ else
+ return round(val / precision) * precision;
}
static int handle_opts( const char **optlist, char **opts, video_info_t *info, resizer_hnd_t *h )
More information about the x264-devel
mailing list