aboutsummaryrefslogtreecommitdiff
path: root/source/rotate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'source/rotate.cc')
-rw-r--r--source/rotate.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/rotate.cc b/source/rotate.cc
index 3678b80a..0ee453c1 100644
--- a/source/rotate.cc
+++ b/source/rotate.cc
@@ -140,6 +140,7 @@ void RotatePlane180(const uint8_t* src,
int height) {
// Swap top and bottom row and mirror the content. Uses a temporary row.
align_buffer_64(row, width);
+ if (!row) return;
const uint8_t* src_bot = src + src_stride * (height - 1);
uint8_t* dst_bot = dst + dst_stride * (height - 1);
int half_height = (height + 1) >> 1;
@@ -544,7 +545,9 @@ static void RotatePlane180_16(const uint16_t* src,
int width,
int height) {
// Swap top and bottom row and mirror the content. Uses a temporary row.
- align_buffer_64_16(row, width);
+ align_buffer_64(row, width * 2);
+ if (!row) return;
+ uint16_t* row_bot = (uint16_t*) row;
const uint16_t* src_bot = src + src_stride * (height - 1);
uint16_t* dst_bot = dst + dst_stride * (height - 1);
int half_height = (height + 1) >> 1;
@@ -552,15 +555,15 @@ static void RotatePlane180_16(const uint16_t* src,
// Odd height will harmlessly mirror the middle row twice.
for (y = 0; y < half_height; ++y) {
- CopyRow_16_C(src, row, width); // Copy top row into buffer
+ CopyRow_16_C(src, row_bot, width); // Copy top row into buffer
MirrorRow_16_C(src_bot, dst, width); // Mirror bottom row into top row
- MirrorRow_16_C(row, dst_bot, width); // Mirror buffer into bottom row
+ MirrorRow_16_C(row_bot, dst_bot, width); // Mirror buffer into bottom row
src += src_stride;
dst += dst_stride;
src_bot -= src_stride;
dst_bot -= dst_stride;
}
- free_aligned_buffer_64_16(row);
+ free_aligned_buffer_64(row);
}
LIBYUV_API