Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: source/row_any.cc

Issue 1398623002: fix jpeg and bt.709 yuvconstants for neon64. (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/planar_functions.cc ('k') | source/row_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2012 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
11 #include "libyuv/row.h" 11 #include "libyuv/row.h"
12 12
13 #include <string.h> // For memset. 13 #include <string.h> // For memset.
14 14
15 #include "libyuv/basic_types.h" 15 #include "libyuv/basic_types.h"
16 16
17 #ifdef __cplusplus 17 #ifdef __cplusplus
18 namespace libyuv { 18 namespace libyuv {
19 extern "C" { 19 extern "C" {
20 #endif 20 #endif
21 21
22 // Subsampled source needs to be increase by 1 of not even. 22 // Subsampled source needs to be increase by 1 of not even.
23 #define SS(width, shift) (((width) + (1 << (shift)) - 1) >> (shift)) 23 #define SS(width, shift) (((width) + (1 << (shift)) - 1) >> (shift))
24 24
25 // Any 4 planes to 1 with yuvconstants 25 // Any 4 planes to 1 with yuvconstants
26 #define ANY41C(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \ 26 #define ANY41C(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \
27 void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \ 27 void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \
28 const uint8* a_buf, uint8* dst_ptr, \ 28 const uint8* a_buf, uint8* dst_ptr, \
29 struct YuvConstants* yuvconstants, int width) { \ 29 const struct YuvConstants* yuvconstants, int width) { \
30 SIMD_ALIGNED(uint8 temp[64 * 5]); \ 30 SIMD_ALIGNED(uint8 temp[64 * 5]); \
31 memset(temp, 0, 64 * 4); /* for msan */ \ 31 memset(temp, 0, 64 * 4); /* for msan */ \
32 int r = width & MASK; \ 32 int r = width & MASK; \
33 int n = width & ~MASK; \ 33 int n = width & ~MASK; \
34 if (n > 0) { \ 34 if (n > 0) { \
35 ANY_SIMD(y_buf, u_buf, v_buf, a_buf, dst_ptr, yuvconstants, n); \ 35 ANY_SIMD(y_buf, u_buf, v_buf, a_buf, dst_ptr, yuvconstants, n); \
36 } \ 36 } \
37 memcpy(temp, y_buf + n, r); \ 37 memcpy(temp, y_buf + n, r); \
38 memcpy(temp + 64, u_buf + (n >> UVSHIFT), SS(r, UVSHIFT)); \ 38 memcpy(temp + 64, u_buf + (n >> UVSHIFT), SS(r, UVSHIFT)); \
39 memcpy(temp + 128, v_buf + (n >> UVSHIFT), SS(r, UVSHIFT)); \ 39 memcpy(temp + 128, v_buf + (n >> UVSHIFT), SS(r, UVSHIFT)); \
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 ANY31(I422ToYUY2Row_Any_NEON, I422ToYUY2Row_NEON, 1, 1, 4, 15) 80 ANY31(I422ToYUY2Row_Any_NEON, I422ToYUY2Row_NEON, 1, 1, 4, 15)
81 #endif 81 #endif
82 #ifdef HAS_I422TOUYVYROW_NEON 82 #ifdef HAS_I422TOUYVYROW_NEON
83 ANY31(I422ToUYVYRow_Any_NEON, I422ToUYVYRow_NEON, 1, 1, 4, 15) 83 ANY31(I422ToUYVYRow_Any_NEON, I422ToUYVYRow_NEON, 1, 1, 4, 15)
84 #endif 84 #endif
85 #undef ANY31 85 #undef ANY31
86 86
87 // Any 3 planes to 1 with yuvconstants 87 // Any 3 planes to 1 with yuvconstants
88 #define ANY31C(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \ 88 #define ANY31C(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \
89 void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \ 89 void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \
90 uint8* dst_ptr, struct YuvConstants* yuvconstants, \ 90 uint8* dst_ptr, const struct YuvConstants* yuvconstants, \
91 int width) { \ 91 int width) { \
92 SIMD_ALIGNED(uint8 temp[64 * 4]); \ 92 SIMD_ALIGNED(uint8 temp[64 * 4]); \
93 memset(temp, 0, 64 * 3); /* for YUY2 and msan */ \ 93 memset(temp, 0, 64 * 3); /* for YUY2 and msan */ \
94 int r = width & MASK; \ 94 int r = width & MASK; \
95 int n = width & ~MASK; \ 95 int n = width & ~MASK; \
96 if (n > 0) { \ 96 if (n > 0) { \
97 ANY_SIMD(y_buf, u_buf, v_buf, dst_ptr, yuvconstants, n); \ 97 ANY_SIMD(y_buf, u_buf, v_buf, dst_ptr, yuvconstants, n); \
98 } \ 98 } \
99 memcpy(temp, y_buf + n, r); \ 99 memcpy(temp, y_buf + n, r); \
100 memcpy(temp + 64, u_buf + (n >> UVSHIFT), SS(r, UVSHIFT)); \ 100 memcpy(temp + 64, u_buf + (n >> UVSHIFT), SS(r, UVSHIFT)); \
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ANY21(SobelXYRow_Any_SSE2, SobelXYRow_SSE2, 0, 1, 1, 4, 15) 247 ANY21(SobelXYRow_Any_SSE2, SobelXYRow_SSE2, 0, 1, 1, 4, 15)
248 #endif 248 #endif
249 #ifdef HAS_SOBELXYROW_NEON 249 #ifdef HAS_SOBELXYROW_NEON
250 ANY21(SobelXYRow_Any_NEON, SobelXYRow_NEON, 0, 1, 1, 4, 7) 250 ANY21(SobelXYRow_Any_NEON, SobelXYRow_NEON, 0, 1, 1, 4, 7)
251 #endif 251 #endif
252 #undef ANY21 252 #undef ANY21
253 253
254 // Any 2 planes to 1 with yuvconstants 254 // Any 2 planes to 1 with yuvconstants
255 #define ANY21C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, SBPP2, BPP, MASK) \ 255 #define ANY21C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, SBPP2, BPP, MASK) \
256 void NAMEANY(const uint8* y_buf, const uint8* uv_buf, \ 256 void NAMEANY(const uint8* y_buf, const uint8* uv_buf, \
257 uint8* dst_ptr, struct YuvConstants* yuvconstants, \ 257 uint8* dst_ptr, const struct YuvConstants* yuvconstants, \
258 int width) { \ 258 int width) { \
259 SIMD_ALIGNED(uint8 temp[64 * 3]); \ 259 SIMD_ALIGNED(uint8 temp[64 * 3]); \
260 memset(temp, 0, 64 * 2); /* for msan */ \ 260 memset(temp, 0, 64 * 2); /* for msan */ \
261 int r = width & MASK; \ 261 int r = width & MASK; \
262 int n = width & ~MASK; \ 262 int n = width & ~MASK; \
263 if (n > 0) { \ 263 if (n > 0) { \
264 ANY_SIMD(y_buf, uv_buf, dst_ptr, yuvconstants, n); \ 264 ANY_SIMD(y_buf, uv_buf, dst_ptr, yuvconstants, n); \
265 } \ 265 } \
266 memcpy(temp, y_buf + n * SBPP, r * SBPP); \ 266 memcpy(temp, y_buf + n * SBPP, r * SBPP); \
267 memcpy(temp + 64, uv_buf + (n >> UVSHIFT) * SBPP2, \ 267 memcpy(temp + 64, uv_buf + (n >> UVSHIFT) * SBPP2, \
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 ANY11(ARGBUnattenuateRow_Any_AVX2, ARGBUnattenuateRow_AVX2, 0, 4, 4, 7) 462 ANY11(ARGBUnattenuateRow_Any_AVX2, ARGBUnattenuateRow_AVX2, 0, 4, 4, 7)
463 #endif 463 #endif
464 #ifdef HAS_ARGBATTENUATEROW_NEON 464 #ifdef HAS_ARGBATTENUATEROW_NEON
465 ANY11(ARGBAttenuateRow_Any_NEON, ARGBAttenuateRow_NEON, 0, 4, 4, 7) 465 ANY11(ARGBAttenuateRow_Any_NEON, ARGBAttenuateRow_NEON, 0, 4, 4, 7)
466 #endif 466 #endif
467 #undef ANY11 467 #undef ANY11
468 468
469 // Any 1 to 1 with yuvconstants 469 // Any 1 to 1 with yuvconstants
470 #define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \ 470 #define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
471 void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \ 471 void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \
472 struct YuvConstants* yuvconstants, int width) { \ 472 const struct YuvConstants* yuvconstants, int width) { \
473 SIMD_ALIGNED(uint8 temp[128 * 2]); \ 473 SIMD_ALIGNED(uint8 temp[128 * 2]); \
474 memset(temp, 0, 128); /* for YUY2 and msan */ \ 474 memset(temp, 0, 128); /* for YUY2 and msan */ \
475 int r = width & MASK; \ 475 int r = width & MASK; \
476 int n = width & ~MASK; \ 476 int n = width & ~MASK; \
477 if (n > 0) { \ 477 if (n > 0) { \
478 ANY_SIMD(src_ptr, dst_ptr, yuvconstants, n); \ 478 ANY_SIMD(src_ptr, dst_ptr, yuvconstants, n); \
479 } \ 479 } \
480 memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \ 480 memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \
481 ANY_SIMD(temp, temp + 128, yuvconstants, MASK + 1); \ 481 ANY_SIMD(temp, temp + 128, yuvconstants, MASK + 1); \
482 memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \ 482 memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 #endif 795 #endif
796 #ifdef HAS_UYVYTOUVROW_NEON 796 #ifdef HAS_UYVYTOUVROW_NEON
797 ANY12S(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, 1, 4, 15) 797 ANY12S(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, 1, 4, 15)
798 #endif 798 #endif
799 #undef ANY12S 799 #undef ANY12S
800 800
801 #ifdef __cplusplus 801 #ifdef __cplusplus
802 } // extern "C" 802 } // extern "C"
803 } // namespace libyuv 803 } // namespace libyuv
804 #endif 804 #endif
OLDNEW
« no previous file with comments | « source/planar_functions.cc ('k') | source/row_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698