@@ -180,46 +180,39 @@ Regression = Utilities.createClass(
180
180
function ( samples , getComplexity , getFrameLength , startIndex , endIndex , options )
181
181
{
182
182
const desiredFrameLength = options . desiredFrameLength ;
183
- var bestProfile ;
183
+ var profile ;
184
184
185
185
if ( ! options . preferredProfile || options . preferredProfile == Strings . json . profiles . slope ) {
186
- var slope = this . _calculateRegression ( samples , getComplexity , getFrameLength , startIndex , endIndex , {
186
+ profile = this . _calculateRegression ( samples , getComplexity , getFrameLength , startIndex , endIndex , {
187
187
shouldClip : true ,
188
188
s1 : desiredFrameLength ,
189
189
t1 : 0
190
190
} ) ;
191
- if ( ! bestProfile || slope . error < bestProfile . error ) {
192
- bestProfile = slope ;
193
- this . profile = Strings . json . profiles . slope ;
194
- }
191
+ this . profile = Strings . json . profiles . slope ;
195
192
}
196
- if ( ! options . preferredProfile || options . preferredProfile == Strings . json . profiles . flat ) {
197
- var flat = this . _calculateRegression ( samples , getComplexity , getFrameLength , startIndex , endIndex , {
193
+ else if ( options . preferredProfile == Strings . json . profiles . flat ) {
194
+ profile = this . _calculateRegression ( samples , getComplexity , getFrameLength , startIndex , endIndex , {
198
195
shouldClip : true ,
199
196
s1 : desiredFrameLength ,
200
197
t1 : 0 ,
201
198
t2 : 0
202
199
} ) ;
203
-
204
- if ( ! bestProfile || flat . error < bestProfile . error ) {
205
- bestProfile = flat ;
206
- this . profile = Strings . json . profiles . flat ;
207
- }
200
+ this . profile = Strings . json . profiles . flat ;
208
201
}
209
202
210
203
this . startIndex = Math . min ( startIndex , endIndex ) ;
211
204
this . endIndex = Math . max ( startIndex , endIndex ) ;
212
205
213
- this . complexity = bestProfile . complexity ;
214
- this . s1 = bestProfile . s1 ;
215
- this . t1 = bestProfile . t1 ;
216
- this . s2 = bestProfile . s2 ;
217
- this . t2 = bestProfile . t2 ;
218
- this . stdev1 = bestProfile . stdev1 ;
219
- this . stdev2 = bestProfile . stdev2 ;
220
- this . n1 = bestProfile . n1 ;
221
- this . n2 = bestProfile . n2 ;
222
- this . error = bestProfile . error ;
206
+ this . complexity = profile . complexity ;
207
+ this . s1 = profile . s1 ;
208
+ this . t1 = profile . t1 ;
209
+ this . s2 = profile . s2 ;
210
+ this . t2 = profile . t2 ;
211
+ this . stdev1 = profile . stdev1 ;
212
+ this . stdev2 = profile . stdev2 ;
213
+ this . n1 = profile . n1 ;
214
+ this . n2 = profile . n2 ;
215
+ this . error = profile . error ;
223
216
} , {
224
217
225
218
valueAt : function ( complexity )
0 commit comments