| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Copy I422. | 121 // Copy I422. |
| 122 LIBYUV_API | 122 LIBYUV_API |
| 123 int I422Copy(const uint8* src_y, int src_stride_y, | 123 int I422Copy(const uint8* src_y, int src_stride_y, |
| 124 const uint8* src_u, int src_stride_u, | 124 const uint8* src_u, int src_stride_u, |
| 125 const uint8* src_v, int src_stride_v, | 125 const uint8* src_v, int src_stride_v, |
| 126 uint8* dst_y, int dst_stride_y, | 126 uint8* dst_y, int dst_stride_y, |
| 127 uint8* dst_u, int dst_stride_u, | 127 uint8* dst_u, int dst_stride_u, |
| 128 uint8* dst_v, int dst_stride_v, | 128 uint8* dst_v, int dst_stride_v, |
| 129 int width, int height) { | 129 int width, int height) { |
| 130 int halfwidth = (width + 1) >> 1; | 130 int halfwidth = (width + 1) >> 1; |
| 131 if (!src_y || !src_u || !src_v || | 131 if (!src_u || !src_v || |
| 132 !dst_y || !dst_u || !dst_v || | 132 !dst_u || !dst_v || |
| 133 width <= 0 || height == 0) { | 133 width <= 0 || height == 0) { |
| 134 return -1; | 134 return -1; |
| 135 } | 135 } |
| 136 // Negative height means invert the image. | 136 // Negative height means invert the image. |
| 137 if (height < 0) { | 137 if (height < 0) { |
| 138 height = -height; | 138 height = -height; |
| 139 src_y = src_y + (height - 1) * src_stride_y; | 139 src_y = src_y + (height - 1) * src_stride_y; |
| 140 src_u = src_u + (height - 1) * src_stride_u; | 140 src_u = src_u + (height - 1) * src_stride_u; |
| 141 src_v = src_v + (height - 1) * src_stride_v; | 141 src_v = src_v + (height - 1) * src_stride_v; |
| 142 src_stride_y = -src_stride_y; | 142 src_stride_y = -src_stride_y; |
| 143 src_stride_u = -src_stride_u; | 143 src_stride_u = -src_stride_u; |
| 144 src_stride_v = -src_stride_v; | 144 src_stride_v = -src_stride_v; |
| 145 } | 145 } |
| 146 CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); | 146 |
| 147 if (dst_y) { |
| 148 CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); |
| 149 } |
| 147 CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, height); | 150 CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, height); |
| 148 CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, height); | 151 CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, height); |
| 149 return 0; | 152 return 0; |
| 150 } | 153 } |
| 151 | 154 |
| 152 // Copy I444. | 155 // Copy I444. |
| 153 LIBYUV_API | 156 LIBYUV_API |
| 154 int I444Copy(const uint8* src_y, int src_stride_y, | 157 int I444Copy(const uint8* src_y, int src_stride_y, |
| 155 const uint8* src_u, int src_stride_u, | 158 const uint8* src_u, int src_stride_u, |
| 156 const uint8* src_v, int src_stride_v, | 159 const uint8* src_v, int src_stride_v, |
| 157 uint8* dst_y, int dst_stride_y, | 160 uint8* dst_y, int dst_stride_y, |
| 158 uint8* dst_u, int dst_stride_u, | 161 uint8* dst_u, int dst_stride_u, |
| 159 uint8* dst_v, int dst_stride_v, | 162 uint8* dst_v, int dst_stride_v, |
| 160 int width, int height) { | 163 int width, int height) { |
| 161 if (!src_y || !src_u || !src_v || | 164 if (!src_u || !src_v || |
| 162 !dst_y || !dst_u || !dst_v || | 165 !dst_u || !dst_v || |
| 163 width <= 0 || height == 0) { | 166 width <= 0 || height == 0) { |
| 164 return -1; | 167 return -1; |
| 165 } | 168 } |
| 166 // Negative height means invert the image. | 169 // Negative height means invert the image. |
| 167 if (height < 0) { | 170 if (height < 0) { |
| 168 height = -height; | 171 height = -height; |
| 169 src_y = src_y + (height - 1) * src_stride_y; | 172 src_y = src_y + (height - 1) * src_stride_y; |
| 170 src_u = src_u + (height - 1) * src_stride_u; | 173 src_u = src_u + (height - 1) * src_stride_u; |
| 171 src_v = src_v + (height - 1) * src_stride_v; | 174 src_v = src_v + (height - 1) * src_stride_v; |
| 172 src_stride_y = -src_stride_y; | 175 src_stride_y = -src_stride_y; |
| 173 src_stride_u = -src_stride_u; | 176 src_stride_u = -src_stride_u; |
| 174 src_stride_v = -src_stride_v; | 177 src_stride_v = -src_stride_v; |
| 175 } | 178 } |
| 176 | 179 |
| 177 CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); | 180 if (dst_y) { |
| 181 CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); |
| 182 } |
| 178 CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, width, height); | 183 CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, width, height); |
| 179 CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, width, height); | 184 CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, width, height); |
| 180 return 0; | 185 return 0; |
| 181 } | 186 } |
| 182 | 187 |
| 183 // Copy I400. | 188 // Copy I400. |
| 184 LIBYUV_API | 189 LIBYUV_API |
| 185 int I400ToI400(const uint8* src_y, int src_stride_y, | 190 int I400ToI400(const uint8* src_y, int src_stride_y, |
| 186 uint8* dst_y, int dst_stride_y, | 191 uint8* dst_y, int dst_stride_y, |
| 187 int width, int height) { | 192 int width, int height) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 207 int width, int height) { | 212 int width, int height) { |
| 208 if (!src_y || !dst_y || width <= 0 || height == 0) { | 213 if (!src_y || !dst_y || width <= 0 || height == 0) { |
| 209 return -1; | 214 return -1; |
| 210 } | 215 } |
| 211 // Negative height means invert the image. | 216 // Negative height means invert the image. |
| 212 if (height < 0) { | 217 if (height < 0) { |
| 213 height = -height; | 218 height = -height; |
| 214 src_y = src_y + (height - 1) * src_stride_y; | 219 src_y = src_y + (height - 1) * src_stride_y; |
| 215 src_stride_y = -src_stride_y; | 220 src_stride_y = -src_stride_y; |
| 216 } | 221 } |
| 222 |
| 217 CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); | 223 CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); |
| 218 return 0; | 224 return 0; |
| 219 } | 225 } |
| 220 | 226 |
| 221 // Mirror a plane of data. | 227 // Mirror a plane of data. |
| 222 void MirrorPlane(const uint8* src_y, int src_stride_y, | 228 void MirrorPlane(const uint8* src_y, int src_stride_y, |
| 223 uint8* dst_y, int dst_stride_y, | 229 uint8* dst_y, int dst_stride_y, |
| 224 int width, int height) { | 230 int width, int height) { |
| 225 int y; | 231 int y; |
| 226 void (*MirrorRow)(const uint8* src, uint8* dst, int width) = MirrorRow_C; | 232 void (*MirrorRow)(const uint8* src, uint8* dst, int width) = MirrorRow_C; |
| (...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 } | 2668 } |
| 2663 free_aligned_buffer_64(rows); | 2669 free_aligned_buffer_64(rows); |
| 2664 } | 2670 } |
| 2665 return 0; | 2671 return 0; |
| 2666 } | 2672 } |
| 2667 | 2673 |
| 2668 #ifdef __cplusplus | 2674 #ifdef __cplusplus |
| 2669 } // extern "C" | 2675 } // extern "C" |
| 2670 } // namespace libyuv | 2676 } // namespace libyuv |
| 2671 #endif | 2677 #endif |
| OLD | NEW |