| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 #endif | 228 #endif |
| 229 #if defined(HAS_INTERPOLATEROW_NEON) | 229 #if defined(HAS_INTERPOLATEROW_NEON) |
| 230 if (TestCpuFlag(kCpuHasNEON)) { | 230 if (TestCpuFlag(kCpuHasNEON)) { |
| 231 InterpolateRow = InterpolateRow_Any_NEON; | 231 InterpolateRow = InterpolateRow_Any_NEON; |
| 232 if (IS_ALIGNED(clip_src_width, 16)) { | 232 if (IS_ALIGNED(clip_src_width, 16)) { |
| 233 InterpolateRow = InterpolateRow_NEON; | 233 InterpolateRow = InterpolateRow_NEON; |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 #endif | 236 #endif |
| 237 #if defined(HAS_INTERPOLATEROW_MIPS_DSPR2) | 237 #if defined(HAS_INTERPOLATEROW_DSPR2) |
| 238 if (TestCpuFlag(kCpuHasMIPS_DSPR2) && | 238 if (TestCpuFlag(kCpuHasDSPR2) && |
| 239 IS_ALIGNED(src_argb, 4) && IS_ALIGNED(src_stride, 4)) { | 239 IS_ALIGNED(src_argb, 4) && IS_ALIGNED(src_stride, 4)) { |
| 240 InterpolateRow = InterpolateRow_Any_MIPS_DSPR2; | 240 InterpolateRow = InterpolateRow_Any_DSPR2; |
| 241 if (IS_ALIGNED(clip_src_width, 4)) { | 241 if (IS_ALIGNED(clip_src_width, 4)) { |
| 242 InterpolateRow = InterpolateRow_MIPS_DSPR2; | 242 InterpolateRow = InterpolateRow_DSPR2; |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 #endif | 245 #endif |
| 246 #if defined(HAS_SCALEARGBFILTERCOLS_SSSE3) | 246 #if defined(HAS_SCALEARGBFILTERCOLS_SSSE3) |
| 247 if (TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) { | 247 if (TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) { |
| 248 ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3; | 248 ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3; |
| 249 } | 249 } |
| 250 #endif | 250 #endif |
| 251 #if defined(HAS_SCALEARGBFILTERCOLS_NEON) | 251 #if defined(HAS_SCALEARGBFILTERCOLS_NEON) |
| 252 if (TestCpuFlag(kCpuHasNEON)) { | 252 if (TestCpuFlag(kCpuHasNEON)) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 317 } |
| 318 #endif | 318 #endif |
| 319 #if defined(HAS_INTERPOLATEROW_NEON) | 319 #if defined(HAS_INTERPOLATEROW_NEON) |
| 320 if (TestCpuFlag(kCpuHasNEON)) { | 320 if (TestCpuFlag(kCpuHasNEON)) { |
| 321 InterpolateRow = InterpolateRow_Any_NEON; | 321 InterpolateRow = InterpolateRow_Any_NEON; |
| 322 if (IS_ALIGNED(dst_width, 4)) { | 322 if (IS_ALIGNED(dst_width, 4)) { |
| 323 InterpolateRow = InterpolateRow_NEON; | 323 InterpolateRow = InterpolateRow_NEON; |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 #endif | 326 #endif |
| 327 #if defined(HAS_INTERPOLATEROW_MIPS_DSPR2) | 327 #if defined(HAS_INTERPOLATEROW_DSPR2) |
| 328 if (TestCpuFlag(kCpuHasMIPS_DSPR2) && | 328 if (TestCpuFlag(kCpuHasDSPR2) && |
| 329 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride, 4)) { | 329 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride, 4)) { |
| 330 InterpolateRow = InterpolateRow_MIPS_DSPR2; | 330 InterpolateRow = InterpolateRow_DSPR2; |
| 331 } | 331 } |
| 332 #endif | 332 #endif |
| 333 if (src_width >= 32768) { | 333 if (src_width >= 32768) { |
| 334 ScaleARGBFilterCols = filtering ? | 334 ScaleARGBFilterCols = filtering ? |
| 335 ScaleARGBFilterCols64_C : ScaleARGBCols64_C; | 335 ScaleARGBFilterCols64_C : ScaleARGBCols64_C; |
| 336 } | 336 } |
| 337 #if defined(HAS_SCALEARGBFILTERCOLS_SSSE3) | 337 #if defined(HAS_SCALEARGBFILTERCOLS_SSSE3) |
| 338 if (filtering && TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) { | 338 if (filtering && TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) { |
| 339 ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3; | 339 ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3; |
| 340 } | 340 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 } | 458 } |
| 459 #endif | 459 #endif |
| 460 #if defined(HAS_I422TOARGBROW_NEON) | 460 #if defined(HAS_I422TOARGBROW_NEON) |
| 461 if (TestCpuFlag(kCpuHasNEON)) { | 461 if (TestCpuFlag(kCpuHasNEON)) { |
| 462 I422ToARGBRow = I422ToARGBRow_Any_NEON; | 462 I422ToARGBRow = I422ToARGBRow_Any_NEON; |
| 463 if (IS_ALIGNED(src_width, 8)) { | 463 if (IS_ALIGNED(src_width, 8)) { |
| 464 I422ToARGBRow = I422ToARGBRow_NEON; | 464 I422ToARGBRow = I422ToARGBRow_NEON; |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 #endif | 467 #endif |
| 468 #if defined(HAS_I422TOARGBROW_MIPS_DSPR2) | 468 #if defined(HAS_I422TOARGBROW_DSPR2) |
| 469 if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(src_width, 4) && | 469 if (TestCpuFlag(kCpuHasDSPR2) && IS_ALIGNED(src_width, 4) && |
| 470 IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && | 470 IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && |
| 471 IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && | 471 IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && |
| 472 IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && | 472 IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && |
| 473 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { | 473 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { |
| 474 I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; | 474 I422ToARGBRow = I422ToARGBRow_DSPR2; |
| 475 } | 475 } |
| 476 #endif | 476 #endif |
| 477 | 477 |
| 478 void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb, | 478 void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb, |
| 479 ptrdiff_t src_stride, int dst_width, int source_y_fraction) = | 479 ptrdiff_t src_stride, int dst_width, int source_y_fraction) = |
| 480 InterpolateRow_C; | 480 InterpolateRow_C; |
| 481 #if defined(HAS_INTERPOLATEROW_SSSE3) | 481 #if defined(HAS_INTERPOLATEROW_SSSE3) |
| 482 if (TestCpuFlag(kCpuHasSSSE3)) { | 482 if (TestCpuFlag(kCpuHasSSSE3)) { |
| 483 InterpolateRow = InterpolateRow_Any_SSSE3; | 483 InterpolateRow = InterpolateRow_Any_SSSE3; |
| 484 if (IS_ALIGNED(dst_width, 4)) { | 484 if (IS_ALIGNED(dst_width, 4)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 495 } | 495 } |
| 496 #endif | 496 #endif |
| 497 #if defined(HAS_INTERPOLATEROW_NEON) | 497 #if defined(HAS_INTERPOLATEROW_NEON) |
| 498 if (TestCpuFlag(kCpuHasNEON)) { | 498 if (TestCpuFlag(kCpuHasNEON)) { |
| 499 InterpolateRow = InterpolateRow_Any_NEON; | 499 InterpolateRow = InterpolateRow_Any_NEON; |
| 500 if (IS_ALIGNED(dst_width, 4)) { | 500 if (IS_ALIGNED(dst_width, 4)) { |
| 501 InterpolateRow = InterpolateRow_NEON; | 501 InterpolateRow = InterpolateRow_NEON; |
| 502 } | 502 } |
| 503 } | 503 } |
| 504 #endif | 504 #endif |
| 505 #if defined(HAS_INTERPOLATEROW_MIPS_DSPR2) | 505 #if defined(HAS_INTERPOLATEROW_DSPR2) |
| 506 if (TestCpuFlag(kCpuHasMIPS_DSPR2) && | 506 if (TestCpuFlag(kCpuHasDSPR2) && |
| 507 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { | 507 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { |
| 508 InterpolateRow = InterpolateRow_MIPS_DSPR2; | 508 InterpolateRow = InterpolateRow_DSPR2; |
| 509 } | 509 } |
| 510 #endif | 510 #endif |
| 511 | 511 |
| 512 void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb, | 512 void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb, |
| 513 int dst_width, int x, int dx) = | 513 int dst_width, int x, int dx) = |
| 514 filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C; | 514 filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C; |
| 515 if (src_width >= 32768) { | 515 if (src_width >= 32768) { |
| 516 ScaleARGBFilterCols = filtering ? | 516 ScaleARGBFilterCols = filtering ? |
| 517 ScaleARGBFilterCols64_C : ScaleARGBCols64_C; | 517 ScaleARGBFilterCols64_C : ScaleARGBCols64_C; |
| 518 } | 518 } |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 int YUVToARGBScaleClip(const uint8* src_y, int src_stride_y, | 828 int YUVToARGBScaleClip(const uint8* src_y, int src_stride_y, |
| 829 const uint8* src_u, int src_stride_u, | 829 const uint8* src_u, int src_stride_u, |
| 830 const uint8* src_v, int src_stride_v, | 830 const uint8* src_v, int src_stride_v, |
| 831 uint32 src_fourcc, | 831 uint32 src_fourcc, |
| 832 int src_width, int src_height, | 832 int src_width, int src_height, |
| 833 uint8* dst_argb, int dst_stride_argb, | 833 uint8* dst_argb, int dst_stride_argb, |
| 834 uint32 dst_fourcc, | 834 uint32 dst_fourcc, |
| 835 int dst_width, int dst_height, | 835 int dst_width, int dst_height, |
| 836 int clip_x, int clip_y, int clip_width, int clip_height, | 836 int clip_x, int clip_y, int clip_width, int clip_height, |
| 837 enum FilterMode filtering) { | 837 enum FilterMode filtering) { |
| 838 | |
| 839 uint8* argb_buffer = (uint8*)malloc(src_width * src_height * 4); | 838 uint8* argb_buffer = (uint8*)malloc(src_width * src_height * 4); |
| 840 int r; | 839 int r; |
| 841 I420ToARGB(src_y, src_stride_y, | 840 I420ToARGB(src_y, src_stride_y, |
| 842 src_u, src_stride_u, | 841 src_u, src_stride_u, |
| 843 src_v, src_stride_v, | 842 src_v, src_stride_v, |
| 844 argb_buffer, src_width * 4, | 843 argb_buffer, src_width * 4, |
| 845 src_width, src_height); | 844 src_width, src_height); |
| 846 | 845 |
| 847 r = ARGBScaleClip(argb_buffer, src_width * 4, | 846 r = ARGBScaleClip(argb_buffer, src_width * 4, |
| 848 src_width, src_height, | 847 src_width, src_height, |
| 849 dst_argb, dst_stride_argb, | 848 dst_argb, dst_stride_argb, |
| 850 dst_width, dst_height, | 849 dst_width, dst_height, |
| 851 clip_x, clip_y, clip_width, clip_height, | 850 clip_x, clip_y, clip_width, clip_height, |
| 852 filtering); | 851 filtering); |
| 853 free(argb_buffer); | 852 free(argb_buffer); |
| 854 return r; | 853 return r; |
| 855 } | 854 } |
| 856 | 855 |
| 857 #ifdef __cplusplus | 856 #ifdef __cplusplus |
| 858 } // extern "C" | 857 } // extern "C" |
| 859 } // namespace libyuv | 858 } // namespace libyuv |
| 860 #endif | 859 #endif |
| OLD | NEW |