diff options
Diffstat (limited to 'source/rotate.cc')
-rw-r--r-- | source/rotate.cc | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/source/rotate.cc b/source/rotate.cc index 0ee453c1..09ba2106 100644 --- a/source/rotate.cc +++ b/source/rotate.cc @@ -693,6 +693,7 @@ int I422Rotate(const uint8_t* src_y, enum RotationMode mode) { int halfwidth = (width + 1) >> 1; int halfheight = (height + 1) >> 1; + int r; if (!src_y || !src_u || !src_v || width <= 0 || height == 0 || !dst_y || !dst_u || !dst_v) { return -1; @@ -728,23 +729,35 @@ int I422Rotate(const uint8_t* src_y, case kRotate90: RotatePlane90(src_u, src_stride_u, dst_y, dst_stride_y, halfwidth, height); - ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_u, dst_stride_u, - halfheight, width, kFilterBilinear); + r = ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_u, + dst_stride_u, halfheight, width, kFilterBilinear); + if (r != 0) { + return r; + } RotatePlane90(src_v, src_stride_v, dst_y, dst_stride_y, halfwidth, height); - ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_v, dst_stride_v, - halfheight, width, kFilterLinear); + r = ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_v, + dst_stride_v, halfheight, width, kFilterLinear); + if (r != 0) { + return r; + } RotatePlane90(src_y, src_stride_y, dst_y, dst_stride_y, width, height); return 0; case kRotate270: RotatePlane270(src_u, src_stride_u, dst_y, dst_stride_y, halfwidth, height); - ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_u, dst_stride_u, - halfheight, width, kFilterBilinear); + r = ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_u, + dst_stride_u, halfheight, width, kFilterBilinear); + if (r != 0) { + return r; + } RotatePlane270(src_v, src_stride_v, dst_y, dst_stride_y, halfwidth, height); - ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_v, dst_stride_v, - halfheight, width, kFilterLinear); + r = ScalePlane(dst_y, dst_stride_y, height, halfwidth, dst_v, + dst_stride_v, halfheight, width, kFilterLinear); + if (r != 0) { + return r; + } RotatePlane270(src_y, src_stride_y, dst_y, dst_stride_y, width, height); return 0; case kRotate180: @@ -1058,6 +1071,7 @@ int I210Rotate(const uint16_t* src_y, enum RotationMode mode) { int halfwidth = (width + 1) >> 1; int halfheight = (height + 1) >> 1; + int r; if (!src_y || !src_u || !src_v || width <= 0 || height == 0 || !dst_y || !dst_u || !dst_v) { return -1; @@ -1093,23 +1107,35 @@ int I210Rotate(const uint16_t* src_y, case kRotate90: RotatePlane90_16(src_u, src_stride_u, dst_y, dst_stride_y, halfwidth, height); - ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_u, dst_stride_u, - halfheight, width, kFilterBilinear); + r = ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_u, + dst_stride_u, halfheight, width, kFilterBilinear); + if (r != 0) { + return r; + } RotatePlane90_16(src_v, src_stride_v, dst_y, dst_stride_y, halfwidth, height); - ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_v, dst_stride_v, - halfheight, width, kFilterLinear); + r = ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_v, + dst_stride_v, halfheight, width, kFilterLinear); + if (r != 0) { + return r; + } RotatePlane90_16(src_y, src_stride_y, dst_y, dst_stride_y, width, height); return 0; case kRotate270: RotatePlane270_16(src_u, src_stride_u, dst_y, dst_stride_y, halfwidth, height); - ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_u, dst_stride_u, - halfheight, width, kFilterBilinear); + r = ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_u, + dst_stride_u, halfheight, width, kFilterBilinear); + if (r != 0) { + return r; + } RotatePlane270_16(src_v, src_stride_v, dst_y, dst_stride_y, halfwidth, height); - ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_v, dst_stride_v, - halfheight, width, kFilterLinear); + r = ScalePlane_16(dst_y, dst_stride_y, height, halfwidth, dst_v, + dst_stride_v, halfheight, width, kFilterLinear); + if (r != 0) { + return r; + } RotatePlane270_16(src_y, src_stride_y, dst_y, dst_stride_y, width, height); return 0; |