| 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 26 matching lines...) Expand all Loading... |
| 37 int src_y_width, int src_y_height, | 37 int src_y_width, int src_y_height, |
| 38 int src_uv_width, int src_uv_height) { | 38 int src_uv_width, int src_uv_height) { |
| 39 const int dst_y_width = Abs(src_y_width); | 39 const int dst_y_width = Abs(src_y_width); |
| 40 const int dst_y_height = Abs(src_y_height); | 40 const int dst_y_height = Abs(src_y_height); |
| 41 const int dst_uv_width = SUBSAMPLE(dst_y_width, 1, 1); | 41 const int dst_uv_width = SUBSAMPLE(dst_y_width, 1, 1); |
| 42 const int dst_uv_height = SUBSAMPLE(dst_y_height, 1, 1); | 42 const int dst_uv_height = SUBSAMPLE(dst_y_height, 1, 1); |
| 43 if (src_y_width == 0 || src_y_height == 0 || | 43 if (src_y_width == 0 || src_y_height == 0 || |
| 44 src_uv_width == 0 || src_uv_height == 0) { | 44 src_uv_width == 0 || src_uv_height == 0) { |
| 45 return -1; | 45 return -1; |
| 46 } | 46 } |
| 47 // TODO(fbarchard): make Y optional. |
| 47 ScalePlane(src_y, src_stride_y, src_y_width, src_y_height, | 48 ScalePlane(src_y, src_stride_y, src_y_width, src_y_height, |
| 48 dst_y, dst_stride_y, dst_y_width, dst_y_height, | 49 dst_y, dst_stride_y, dst_y_width, dst_y_height, |
| 49 kFilterBilinear); | 50 kFilterBilinear); |
| 50 ScalePlane(src_u, src_stride_u, src_uv_width, src_uv_height, | 51 ScalePlane(src_u, src_stride_u, src_uv_width, src_uv_height, |
| 51 dst_u, dst_stride_u, dst_uv_width, dst_uv_height, | 52 dst_u, dst_stride_u, dst_uv_width, dst_uv_height, |
| 52 kFilterBilinear); | 53 kFilterBilinear); |
| 53 ScalePlane(src_v, src_stride_v, src_uv_width, src_uv_height, | 54 ScalePlane(src_v, src_stride_v, src_uv_width, src_uv_height, |
| 54 dst_v, dst_stride_v, dst_uv_width, dst_uv_height, | 55 dst_v, dst_stride_v, dst_uv_width, dst_uv_height, |
| 55 kFilterBilinear); | 56 kFilterBilinear); |
| 56 return 0; | 57 return 0; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // this as well as the two Y planes. | 307 // this as well as the two Y planes. |
| 307 static int X420ToI420(const uint8* src_y, | 308 static int X420ToI420(const uint8* src_y, |
| 308 int src_stride_y0, int src_stride_y1, | 309 int src_stride_y0, int src_stride_y1, |
| 309 const uint8* src_uv, int src_stride_uv, | 310 const uint8* src_uv, int src_stride_uv, |
| 310 uint8* dst_y, int dst_stride_y, | 311 uint8* dst_y, int dst_stride_y, |
| 311 uint8* dst_u, int dst_stride_u, | 312 uint8* dst_u, int dst_stride_u, |
| 312 uint8* dst_v, int dst_stride_v, | 313 uint8* dst_v, int dst_stride_v, |
| 313 int width, int height) { | 314 int width, int height) { |
| 314 int halfwidth = (width + 1) >> 1; | 315 int halfwidth = (width + 1) >> 1; |
| 315 int halfheight = (height + 1) >> 1; | 316 int halfheight = (height + 1) >> 1; |
| 316 if (!src_y || !src_uv || | 317 if (!src_uv || !dst_u || !dst_v || |
| 317 !dst_y || !dst_u || !dst_v || | |
| 318 width <= 0 || height == 0) { | 318 width <= 0 || height == 0) { |
| 319 return -1; | 319 return -1; |
| 320 } | 320 } |
| 321 // Negative height means invert the image. | 321 // Negative height means invert the image. |
| 322 if (height < 0) { | 322 if (height < 0) { |
| 323 height = -height; | 323 height = -height; |
| 324 halfheight = (height + 1) >> 1; | 324 halfheight = (height + 1) >> 1; |
| 325 dst_y = dst_y + (height - 1) * dst_stride_y; | 325 dst_y = dst_y + (height - 1) * dst_stride_y; |
| 326 dst_u = dst_u + (halfheight - 1) * dst_stride_u; | 326 dst_u = dst_u + (halfheight - 1) * dst_stride_u; |
| 327 dst_v = dst_v + (halfheight - 1) * dst_stride_v; | 327 dst_v = dst_v + (halfheight - 1) * dst_stride_v; |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 dst_u += dst_stride_u; | 1483 dst_u += dst_stride_u; |
| 1484 dst_v += dst_stride_v; | 1484 dst_v += dst_stride_v; |
| 1485 } | 1485 } |
| 1486 return 0; | 1486 return 0; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 #ifdef __cplusplus | 1489 #ifdef __cplusplus |
| 1490 } // extern "C" | 1490 } // extern "C" |
| 1491 } // namespace libyuv | 1491 } // namespace libyuv |
| 1492 #endif | 1492 #endif |
| OLD | NEW |