[x264-devel] commit: Fix weightp analysis with high bit depth (Jason Garrett-Glaser )
git at videolan.org
git at videolan.org
Wed Dec 15 04:19:31 CET 2010
x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Dec 11 13:37:09 2010 -0800| [22af357718b03756263342a34d32157de8ee769d] | committer: Jason Garrett-Glaser
Fix weightp analysis with high bit depth
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=22af357718b03756263342a34d32157de8ee769d
---
encoder/slicetype.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 5c9f500..e6018f1 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -238,8 +238,8 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
float fenc_var = fenc->i_pixel_ssd[plane] + !ref->i_pixel_ssd[plane];
float ref_var = ref->i_pixel_ssd[plane] + !ref->i_pixel_ssd[plane];
float guess_scale = sqrtf( fenc_var / ref_var );
- float fenc_mean = (float)fenc->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]);
- float ref_mean = (float) ref->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]);
+ float fenc_mean = (float)fenc->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8));
+ float ref_mean = (float) ref->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8));
//early termination
if( fabsf( ref_mean - fenc_mean ) < 0.5f && fabsf( 1.f - guess_scale ) < epsilon )
More information about the x264-devel
mailing list