mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-07-30 08:16:22 +08:00
Add more size_t and ptrdiff_t casts
Change-Id: If1a8140ffa2d471d72ff3a134158c89a2d883b4c Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8119790 Reviewed-by: Frank Barchard <fbarchard@google.com> Commit-Queue: Wan-Teh Chang <wtc@google.com>
This commit is contained in:
parent
c1e9e69826
commit
c302f85bb1
@ -2852,7 +2852,7 @@ void ARGBMirrorRow_C(const uint8_t* src, uint8_t* dst, int width) {
|
||||
|
||||
void RGB24MirrorRow_C(const uint8_t* src_rgb24, uint8_t* dst_rgb24, int width) {
|
||||
int x;
|
||||
src_rgb24 += width * 3 - 3;
|
||||
src_rgb24 += (ptrdiff_t)width * 3 - 3;
|
||||
for (x = 0; x < width; ++x) {
|
||||
uint8_t b = src_rgb24[0];
|
||||
uint8_t g = src_rgb24[1];
|
||||
@ -3292,7 +3292,7 @@ void CopyRow_C(const uint8_t* src, uint8_t* dst, int count) {
|
||||
}
|
||||
|
||||
void CopyRow_16_C(const uint16_t* src, uint16_t* dst, int count) {
|
||||
memcpy(dst, src, count * 2);
|
||||
memcpy(dst, src, (size_t)count * 2);
|
||||
}
|
||||
|
||||
void SetRow_C(uint8_t* dst, uint8_t v8, int width) {
|
||||
@ -3315,8 +3315,9 @@ void YUY2ToUVRow_C(const uint8_t* src_yuy2,
|
||||
// Output a row of UV values, filtering 2 rows of YUY2.
|
||||
int x;
|
||||
for (x = 0; x < width; x += 2) {
|
||||
dst_u[0] = (src_yuy2[1] + src_yuy2[src_stride_yuy2 + 1] + 1) >> 1;
|
||||
dst_v[0] = (src_yuy2[3] + src_yuy2[src_stride_yuy2 + 3] + 1) >> 1;
|
||||
const uint8_t* src_yuy2_next = src_yuy2 + src_stride_yuy2;
|
||||
dst_u[0] = (src_yuy2[1] + src_yuy2_next[1] + 1) >> 1;
|
||||
dst_v[0] = (src_yuy2[3] + src_yuy2_next[3] + 1) >> 1;
|
||||
src_yuy2 += 4;
|
||||
dst_u += 1;
|
||||
dst_v += 1;
|
||||
@ -3331,8 +3332,9 @@ void YUY2ToNVUVRow_C(const uint8_t* src_yuy2,
|
||||
// Output a row of UV values, filtering 2 rows of YUY2.
|
||||
int x;
|
||||
for (x = 0; x < width; x += 2) {
|
||||
dst_uv[0] = (src_yuy2[1] + src_yuy2[src_stride_yuy2 + 1] + 1) >> 1;
|
||||
dst_uv[1] = (src_yuy2[3] + src_yuy2[src_stride_yuy2 + 3] + 1) >> 1;
|
||||
const uint8_t* src_yuy2_next = src_yuy2 + src_stride_yuy2;
|
||||
dst_uv[0] = (src_yuy2[1] + src_yuy2_next[1] + 1) >> 1;
|
||||
dst_uv[1] = (src_yuy2[3] + src_yuy2_next[3] + 1) >> 1;
|
||||
src_yuy2 += 4;
|
||||
dst_uv += 2;
|
||||
}
|
||||
@ -3377,8 +3379,9 @@ void UYVYToUVRow_C(const uint8_t* src_uyvy,
|
||||
// Output a row of UV values.
|
||||
int x;
|
||||
for (x = 0; x < width; x += 2) {
|
||||
dst_u[0] = (src_uyvy[0] + src_uyvy[src_stride_uyvy + 0] + 1) >> 1;
|
||||
dst_v[0] = (src_uyvy[2] + src_uyvy[src_stride_uyvy + 2] + 1) >> 1;
|
||||
const uint8_t* src_uyvy_next = src_uyvy + src_stride_uyvy;
|
||||
dst_u[0] = (src_uyvy[0] + src_uyvy_next[0] + 1) >> 1;
|
||||
dst_v[0] = (src_uyvy[2] + src_uyvy_next[2] + 1) >> 1;
|
||||
src_uyvy += 4;
|
||||
dst_u += 1;
|
||||
dst_v += 1;
|
||||
@ -3753,7 +3756,7 @@ void InterpolateRow_16_C(uint16_t* dst_ptr,
|
||||
assert(source_y_fraction < 256);
|
||||
|
||||
if (y1_fraction == 0) {
|
||||
memcpy(dst_ptr, src_ptr, width * 2);
|
||||
memcpy(dst_ptr, src_ptr, (size_t)width * 2);
|
||||
return;
|
||||
}
|
||||
if (y1_fraction == 128) {
|
||||
@ -4452,18 +4455,20 @@ void AYUVToUVRow_C(const uint8_t* src_ayuv,
|
||||
// Output a row of UV values, filtering 2x2 rows of AYUV.
|
||||
int x;
|
||||
for (x = 0; x < width - 1; x += 2) {
|
||||
dst_uv[0] = (src_ayuv[1] + src_ayuv[5] + src_ayuv[src_stride_ayuv + 1] +
|
||||
src_ayuv[src_stride_ayuv + 5] + 2) >>
|
||||
2;
|
||||
dst_uv[1] = (src_ayuv[0] + src_ayuv[4] + src_ayuv[src_stride_ayuv + 0] +
|
||||
src_ayuv[src_stride_ayuv + 4] + 2) >>
|
||||
2;
|
||||
const uint8_t* src_ayuv_next = src_ayuv + src_stride_ayuv;
|
||||
dst_uv[0] =
|
||||
(src_ayuv[1] + src_ayuv[5] + src_ayuv_next[1] + src_ayuv_next[5] + 2) >>
|
||||
2;
|
||||
dst_uv[1] =
|
||||
(src_ayuv[0] + src_ayuv[4] + src_ayuv_next[0] + src_ayuv_next[4] + 2) >>
|
||||
2;
|
||||
src_ayuv += 8;
|
||||
dst_uv += 2;
|
||||
}
|
||||
if (width & 1) {
|
||||
dst_uv[0] = (src_ayuv[1] + src_ayuv[src_stride_ayuv + 1] + 1) >> 1;
|
||||
dst_uv[1] = (src_ayuv[0] + src_ayuv[src_stride_ayuv + 0] + 1) >> 1;
|
||||
const uint8_t* src_ayuv_next = src_ayuv + src_stride_ayuv;
|
||||
dst_uv[0] = (src_ayuv[1] + src_ayuv_next[1] + 1) >> 1;
|
||||
dst_uv[1] = (src_ayuv[0] + src_ayuv_next[0] + 1) >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4475,18 +4480,20 @@ void AYUVToVURow_C(const uint8_t* src_ayuv,
|
||||
// Output a row of VU values, filtering 2x2 rows of AYUV.
|
||||
int x;
|
||||
for (x = 0; x < width - 1; x += 2) {
|
||||
dst_vu[0] = (src_ayuv[0] + src_ayuv[4] + src_ayuv[src_stride_ayuv + 0] +
|
||||
src_ayuv[src_stride_ayuv + 4] + 2) >>
|
||||
2;
|
||||
dst_vu[1] = (src_ayuv[1] + src_ayuv[5] + src_ayuv[src_stride_ayuv + 1] +
|
||||
src_ayuv[src_stride_ayuv + 5] + 2) >>
|
||||
2;
|
||||
const uint8_t* src_ayuv_next = src_ayuv + src_stride_ayuv;
|
||||
dst_vu[0] =
|
||||
(src_ayuv[0] + src_ayuv[4] + src_ayuv_next[0] + src_ayuv_next[4] + 2) >>
|
||||
2;
|
||||
dst_vu[1] =
|
||||
(src_ayuv[1] + src_ayuv[5] + src_ayuv_next[1] + src_ayuv_next[5] + 2) >>
|
||||
2;
|
||||
src_ayuv += 8;
|
||||
dst_vu += 2;
|
||||
}
|
||||
if (width & 1) {
|
||||
dst_vu[0] = (src_ayuv[0] + src_ayuv[src_stride_ayuv + 0] + 1) >> 1;
|
||||
dst_vu[1] = (src_ayuv[1] + src_ayuv[src_stride_ayuv + 1] + 1) >> 1;
|
||||
const uint8_t* src_ayuv_next = src_ayuv + src_stride_ayuv;
|
||||
dst_vu[0] = (src_ayuv[0] + src_ayuv_next[0] + 1) >> 1;
|
||||
dst_vu[1] = (src_ayuv[1] + src_ayuv_next[1] + 1) >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4521,19 +4528,19 @@ void HalfMergeUVRow_C(const uint8_t* src_u,
|
||||
int width) {
|
||||
int x;
|
||||
for (x = 0; x < width - 1; x += 2) {
|
||||
dst_uv[0] = (src_u[0] + src_u[1] + src_u[src_stride_u] +
|
||||
src_u[src_stride_u + 1] + 2) >>
|
||||
2;
|
||||
dst_uv[1] = (src_v[0] + src_v[1] + src_v[src_stride_v] +
|
||||
src_v[src_stride_v + 1] + 2) >>
|
||||
2;
|
||||
const uint8_t* src_u_next = src_u + src_stride_u;
|
||||
dst_uv[0] = (src_u[0] + src_u[1] + src_u_next[0] + src_u_next[1] + 2) >> 2;
|
||||
const uint8_t* src_v_next = src_v + src_stride_v;
|
||||
dst_uv[1] = (src_v[0] + src_v[1] + src_v_next[0] + src_v_next[1] + 2) >> 2;
|
||||
src_u += 2;
|
||||
src_v += 2;
|
||||
dst_uv += 2;
|
||||
}
|
||||
if (width & 1) {
|
||||
dst_uv[0] = (src_u[0] + src_u[src_stride_u] + 1) >> 1;
|
||||
dst_uv[1] = (src_v[0] + src_v[src_stride_v] + 1) >> 1;
|
||||
const uint8_t* src_u_next = src_u + src_stride_u;
|
||||
dst_uv[0] = (src_u[0] + src_u_next[0] + 1) >> 1;
|
||||
const uint8_t* src_v_next = src_v + src_stride_v;
|
||||
dst_uv[1] = (src_v[0] + src_v_next[0] + 1) >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user