Fix fitness distance in video capture constraints processing
The old algorithm computed fitness for width, height and aspect ratio using the best possible width, height and aspect ratio supported by a constrained format. However, the actual selected resolution does not necessarily have the width, height and aspect ratio that are simultaneously closest to the ideal values. In practice, this results in differences only in marginal cases such as: * Extreme ideal aspect ratios, where rounding a selected resolution in floating-point format might lead to a significant variation in aspect ratio. For example (1000x1.25 has aspect ratio 800 before rounding but aspect ratio 1000 after rounding to 1000x1). This is not an issue for resolutions that are used in practice and the spec allows some deviation in the optimization of the fitness distance anyway. * The ideal aspect ratio significantly contradicts the ratio between the ideal width and the ideal height. In this case, the selected point will be close to ideal width and ideal height, but might be far from the ideal aspect ratio (which is ignored), thus it might have a higher fitness distance than the one computed by the old algorithm. This minor fix has more importance when extra complexity is added to the computation of fitness distance to support the new resizeMode constraint in a follow-up CL. Bug: 854980 Change-Id: I0cadb28553816357ce84bbf38b5686cc48b427e7 Reviewed-on: https://chromium-review.googlesource.com/c/1329788Reviewed-by:Henrik Boström <hbos@chromium.org> Commit-Queue: Guido Urdaneta <guidou@chromium.org> Cr-Commit-Position: refs/heads/master@{#610015}
Showing
Please register or sign in to comment