lut_inverse_interp16: better handle degenerate TRC curves

Degenerate TRC have runs of 0's / 1's from the left / right edge of
the TRC curve (a curve we want to invert), but the inverse curve is
not well-defined in those regions. Return 0 or 1 for the inverse in
those regions. Also ensure the binary search parameters are bounded
to a valid search range.

BUG=458024

Review URL: https://codereview.chromium.org/1016213002

Cr-Commit-Position: refs/heads/master@{#321930}
2 files changed