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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 int dy = FixedDiv(src_height, dst_height); | 1404 int dy = FixedDiv(src_height, dst_height); |
1405 // Arbitrary scale vertically, but unscaled horizontally. | 1405 // Arbitrary scale vertically, but unscaled horizontally. |
1406 ScalePlaneVertical(src_height, | 1406 ScalePlaneVertical(src_height, |
1407 dst_width, dst_height, | 1407 dst_width, dst_height, |
1408 src_stride, dst_stride, src, dst, | 1408 src_stride, dst_stride, src, dst, |
1409 0, 0, dy, 1, filtering); | 1409 0, 0, dy, 1, filtering); |
1410 return; | 1410 return; |
1411 } | 1411 } |
1412 if (dst_width <= Abs(src_width) && dst_height <= src_height) { | 1412 if (dst_width <= Abs(src_width) && dst_height <= src_height) { |
1413 // Scale down. | 1413 // Scale down. |
1414 if (4 * dst_width == 3 * src_width && | 1414 if (4 * dst_width == 3 * src_width && 4 * dst_height == 3 * src_height) { |
1415 4 * dst_height == 3 * src_height) { | |
1416 // optimized, 3/4 | 1415 // optimized, 3/4 |
1417 ScalePlaneDown34(src_width, src_height, dst_width, dst_height, | 1416 ScalePlaneDown34(src_width, src_height, dst_width, dst_height, |
1418 src_stride, dst_stride, src, dst, filtering); | 1417 src_stride, dst_stride, src, dst, filtering); |
1419 return; | 1418 return; |
1420 } | 1419 } |
1421 if (2 * dst_width == src_width && 2 * dst_height == src_height) { | 1420 if (2 * dst_width == src_width && 2 * dst_height == src_height) { |
1422 // optimized, 1/2 | 1421 // optimized, 1/2 |
1423 ScalePlaneDown2(src_width, src_height, dst_width, dst_height, | 1422 ScalePlaneDown2(src_width, src_height, dst_width, dst_height, |
1424 src_stride, dst_stride, src, dst, filtering); | 1423 src_stride, dst_stride, src, dst, filtering); |
1425 return; | 1424 return; |
1426 } | 1425 } |
1427 // 3/8 rounded up for odd sized chroma height. | 1426 // 3/8 rounded up for odd sized chroma height. |
1428 if (8 * dst_width == 3 * src_width && | 1427 if (8 * dst_width == 3 * src_width && 8 * dst_height == 3 * src_height) { |
1429 dst_height == ((src_height * 3 + 7) / 8)) { | |
1430 // optimized, 3/8 | 1428 // optimized, 3/8 |
1431 ScalePlaneDown38(src_width, src_height, dst_width, dst_height, | 1429 ScalePlaneDown38(src_width, src_height, dst_width, dst_height, |
1432 src_stride, dst_stride, src, dst, filtering); | 1430 src_stride, dst_stride, src, dst, filtering); |
1433 return; | 1431 return; |
1434 } | 1432 } |
1435 if (4 * dst_width == src_width && 4 * dst_height == src_height && | 1433 if (4 * dst_width == src_width && 4 * dst_height == src_height && |
1436 (filtering == kFilterBox || filtering == kFilterNone)) { | 1434 (filtering == kFilterBox || filtering == kFilterNone)) { |
1437 // optimized, 1/4 | 1435 // optimized, 1/4 |
1438 ScalePlaneDown4(src_width, src_height, dst_width, dst_height, | 1436 ScalePlaneDown4(src_width, src_height, dst_width, dst_height, |
1439 src_stride, dst_stride, src, dst, filtering); | 1437 src_stride, dst_stride, src, dst, filtering); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 src_stride, dst_stride, src, dst, filtering); | 1499 src_stride, dst_stride, src, dst, filtering); |
1502 return; | 1500 return; |
1503 } | 1501 } |
1504 if (2 * dst_width == src_width && 2 * dst_height == src_height) { | 1502 if (2 * dst_width == src_width && 2 * dst_height == src_height) { |
1505 // optimized, 1/2 | 1503 // optimized, 1/2 |
1506 ScalePlaneDown2_16(src_width, src_height, dst_width, dst_height, | 1504 ScalePlaneDown2_16(src_width, src_height, dst_width, dst_height, |
1507 src_stride, dst_stride, src, dst, filtering); | 1505 src_stride, dst_stride, src, dst, filtering); |
1508 return; | 1506 return; |
1509 } | 1507 } |
1510 // 3/8 rounded up for odd sized chroma height. | 1508 // 3/8 rounded up for odd sized chroma height. |
1511 if (8 * dst_width == 3 * src_width && | 1509 if (8 * dst_width == 3 * src_width && 8 * dst_height == 3 * src_height) { |
1512 dst_height == ((src_height * 3 + 7) / 8)) { | |
1513 // optimized, 3/8 | 1510 // optimized, 3/8 |
1514 ScalePlaneDown38_16(src_width, src_height, dst_width, dst_height, | 1511 ScalePlaneDown38_16(src_width, src_height, dst_width, dst_height, |
1515 src_stride, dst_stride, src, dst, filtering); | 1512 src_stride, dst_stride, src, dst, filtering); |
1516 return; | 1513 return; |
1517 } | 1514 } |
1518 if (4 * dst_width == src_width && 4 * dst_height == src_height && | 1515 if (4 * dst_width == src_width && 4 * dst_height == src_height && |
1519 filtering != kFilterBilinear) { | 1516 filtering != kFilterBilinear) { |
1520 // optimized, 1/4 | 1517 // optimized, 1/4 |
1521 ScalePlaneDown4_16(src_width, src_height, dst_width, dst_height, | 1518 ScalePlaneDown4_16(src_width, src_height, dst_width, dst_height, |
1522 src_stride, dst_stride, src, dst, filtering); | 1519 src_stride, dst_stride, src, dst, filtering); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 dst_u, dst_halfwidth, | 1660 dst_u, dst_halfwidth, |
1664 dst_v, dst_halfwidth, | 1661 dst_v, dst_halfwidth, |
1665 dst_width, aheight, | 1662 dst_width, aheight, |
1666 interpolate ? kFilterBox : kFilterNone); | 1663 interpolate ? kFilterBox : kFilterNone); |
1667 } | 1664 } |
1668 | 1665 |
1669 #ifdef __cplusplus | 1666 #ifdef __cplusplus |
1670 } // extern "C" | 1667 } // extern "C" |
1671 } // namespace libyuv | 1668 } // namespace libyuv |
1672 #endif | 1669 #endif |
OLD | NEW |