Introduce `BKE_fcurve_deduplicate_keys()` to merge keys that are on the same time, or within the time comparison threshold (1/100th of a frame). When merging two consecutive keys, the last one 'wins' and determines the final key *value*. The first key's *time* is retained, to ensure the reference point for the next comparisons is stable. The only exception here is when there is a key exactly on an integer frame number, in which case that one is preferred. The function is exposed in RNA as `fcurve.keyframe_points.deduplicate()` This commit also introduces a new function `BKE_fcurve_bezt_shrink(fcu, new_totvert);` that can reallocate the `bezt` array to ensure removed keys no longer take up memory. The RNA function `fcurve.update()` currently performs two steps, which are now exposed to RNA as well, as `keyframe_points.sort()` and `keyframe_points.handles_recalc()`. This is so that Python code can sort, deduplicate, and then recalculate the handles only once (calling `update` + `deduplicate` would do the latter twice). In Blender 4.0 the deduplication will also be part of `fcurve.update()`, see #107126. Reviewed on blender/blender#107089