aboutsummaryrefslogtreecommitdiff
path: root/source/scale_common.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2023-04-12 15:32:23 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-12 22:49:20 +0000
commit68659d0d681b4c2318407f7dbc6eaa40055adba1 (patch)
tree128bde23ae4f06800ecadbf2098db3a7b2daf995 /source/scale_common.cc
parentee3e71c7ce6c21cc96e27a32d3f94979f978eeaa (diff)
downloadlibyuv-68659d0d681b4c2318407f7dbc6eaa40055adba1.tar.gz
UVScale down by 2 fix for C and optimize for NEON
- update cpu_id to use "re" for fopen to avoid leaking handles if a thread is started while the file is open. Bug: libyuv:958 Change-Id: I1af9de68fce12e440e1226fc8070634ccb1bf090 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4417176 Reviewed-by: Wan-Teh Chang <wtc@google.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/scale_common.cc')
-rw-r--r--source/scale_common.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/source/scale_common.cc b/source/scale_common.cc
index da9ca713..5e603fd4 100644
--- a/source/scale_common.cc
+++ b/source/scale_common.cc
@@ -1280,18 +1280,13 @@ void ScaleUVRowDown2_C(const uint8_t* src_uv,
ptrdiff_t src_stride,
uint8_t* dst_uv,
int dst_width) {
- const uint16_t* src = (const uint16_t*)(src_uv);
- uint16_t* dst = (uint16_t*)(dst_uv);
int x;
(void)src_stride;
- for (x = 0; x < dst_width - 1; x += 2) {
- dst[0] = src[1];
- dst[1] = src[3];
- src += 2;
- dst += 2;
- }
- if (dst_width & 1) {
- dst[0] = src[1];
+ for (x = 0; x < dst_width; ++x) {
+ dst_uv[0] = src_uv[2]; // Store the 2nd UV
+ dst_uv[1] = src_uv[3];
+ src_uv += 4;
+ dst_uv += 2;
}
}