projects
/
openjpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e933506
)
use tolerance to bail out early from rate control : much faster
author
Aaron Boxer
<boxerab@gmail.com>
Fri, 1 Sep 2017 23:33:40 +0000
(19:33 -0400)
committer
cah
<cah@ableton.com>
Tue, 3 Dec 2019 10:36:51 +0000
(11:36 +0100)
src/lib/openjp2/tcd.c
patch
|
blob
|
history
diff --git
a/src/lib/openjp2/tcd.c
b/src/lib/openjp2/tcd.c
index 13d6692bd9a89402fba723caf5461463fa2d903b..b3e789e3353602f8347c76e323b400356c5f69b1 100644
(file)
--- a/
src/lib/openjp2/tcd.c
+++ b/
src/lib/openjp2/tcd.c
@@
-539,6
+539,8
@@
OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_UINT32) ceil(tcd_tcp->rates[layno])), len) : len;
OPJ_FLOAT64 goodthresh = 0;
OPJ_FLOAT64 stable_thresh = 0;
OPJ_UINT32) ceil(tcd_tcp->rates[layno])), len) : len;
OPJ_FLOAT64 goodthresh = 0;
OPJ_FLOAT64 stable_thresh = 0;
+ OPJ_FLOAT64 old_thresh = -1;
+ const OPJ_FLOAT64 tolerance = 0.01;
OPJ_UINT32 i;
OPJ_FLOAT64 distotarget; /* fixed_quality */
OPJ_UINT32 i;
OPJ_FLOAT64 distotarget; /* fixed_quality */
@@
-567,6
+569,9
@@
OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
thresh = (lo + hi) / 2;
opj_tcd_makelayer(tcd, layno, thresh, 0);
thresh = (lo + hi) / 2;
opj_tcd_makelayer(tcd, layno, thresh, 0);
+ if ((fabs(old_thresh - thresh)) < tolerance)
+ break;
+ old_thresh = thresh;
if (cp->m_specific_param.m_enc.m_fixed_quality) { /* fixed_quality */
if (OPJ_IS_CINEMA(cp->rsiz)) {
if (cp->m_specific_param.m_enc.m_fixed_quality) { /* fixed_quality */
if (OPJ_IS_CINEMA(cp->rsiz)) {