Wan-Teh Chang 3c3b36d939 Make sure offset_x/y is even before CropAndScale()
CropAndScale() makes offset_x and offset_y even if the U,V planes are
subsampled. This may result in the update rect being off by one. To
prevent that, always pass even offset_x and offset_y to CropAndScale().

Round the offset up when dividing crop size by 2 to make the cropping
more centered and symmetrical.

Note: The code was originally added in
https://webrtc-review.googlesource.com/c/src/+/123230.

Bug: webrtc:15910
Change-Id: I4a70d460702f03dee72a5b8292cb25766c3e6aca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/346323
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Cr-Commit-Position: refs/heads/main@{#42052}
2024-04-12 13:42:19 +00:00
..
2024-02-26 11:26:04 +00:00
2024-02-26 11:26:04 +00:00