Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(522966)

Unified Diff: src/pvq.c

Issue 1442: pvq: improve rounding bias for int max_theta
Patch Set: Created 2 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pvq.c
diff --git a/src/pvq.c b/src/pvq.c
index c17fd508f0f8de77319991206a2d30081c060f36..8a78c91bb80bc6dfdce84190427ed4da1c393941 100644
--- a/src/pvq.c
+++ b/src/pvq.c
@@ -734,8 +734,8 @@ int od_pvq_compute_max_theta(od_val32 qcg, double beta){
#if defined(OD_FLOAT_PVQ)
int ts = (int)floor(.5 + qcg*OD_CGAIN_SCALE_1*M_PI/(2*beta));
#else
- int ts = OD_SHR_ROUND((int)floor(.5 + qcg*OD_QCONST32(M_PI,
- OD_CGAIN_SHIFT)/(2*beta)), OD_CGAIN_SHIFT*2);
+ int ts = ((int)floor(.5 + qcg*OD_QCONST32(M_PI, OD_CGAIN_SHIFT)/(2*beta))
+ - (1 << OD_CGAIN_SHIFT*2 >> 2)) >> OD_CGAIN_SHIFT*2;
jm 2016/08/23 15:19:18 This should probably be updated now that beta is f
#endif
/* Special case for low gains -- will need to be tuned anyway */
if (qcg < OD_QCONST32(1.4, OD_CGAIN_SHIFT)) ts = 1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld