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

Side by Side Diff: source/row_common.cc

Issue 1535833003: avx2 interpolate use 8 bit (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: gcc version of interpolate Created 5 years 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 | « include/libyuv/version.h ('k') | source/row_gcc.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 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 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 int x; 2204 int x;
2205 for (x = 0; x < width; ++x) { 2205 for (x = 0; x < width; ++x) {
2206 dst_uv[x] = (src_uv[x] + src_uv[src_uv_stride + x] + 1) >> 1; 2206 dst_uv[x] = (src_uv[x] + src_uv[src_uv_stride + x] + 1) >> 1;
2207 } 2207 }
2208 } 2208 }
2209 2209
2210 // C version 2x2 -> 2x1. 2210 // C version 2x2 -> 2x1.
2211 void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr, 2211 void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr,
2212 ptrdiff_t src_stride, 2212 ptrdiff_t src_stride,
2213 int width, int source_y_fraction) { 2213 int width, int source_y_fraction) {
2214 int y1_fraction = source_y_fraction >> 1; 2214 int y1_fraction = source_y_fraction ;
2215 int y0_fraction = 128 - y1_fraction; 2215 int y0_fraction = 256 - y1_fraction;
2216 const uint8* src_ptr1 = src_ptr + src_stride; 2216 const uint8* src_ptr1 = src_ptr + src_stride;
2217 int x; 2217 int x;
2218 if (y1_fraction == 0) { 2218 if (y1_fraction == 0) {
2219 memcpy(dst_ptr, src_ptr, width); 2219 memcpy(dst_ptr, src_ptr, width);
2220 return; 2220 return;
2221 } 2221 }
2222 if (y1_fraction == 64) { 2222 if (y1_fraction == 128) {
2223 HalfRow_C(src_ptr, (int)(src_stride), dst_ptr, width); 2223 HalfRow_C(src_ptr, (int)(src_stride), dst_ptr, width);
2224 return; 2224 return;
2225 } 2225 }
2226 for (x = 0; x < width - 1; x += 2) { 2226 for (x = 0; x < width - 1; x += 2) {
2227 dst_ptr[0] = 2227 dst_ptr[0] =
2228 » » (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction + 64) >> 7 ; 2228 (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction + 128) >> 8;
2229 dst_ptr[1] = 2229 dst_ptr[1] =
2230 » » (src_ptr[1] * y0_fraction + src_ptr1[1] * y1_fraction + 64) >> 7 ; 2230 (src_ptr[1] * y0_fraction + src_ptr1[1] * y1_fraction + 128) >> 8;
2231 src_ptr += 2; 2231 src_ptr += 2;
2232 src_ptr1 += 2; 2232 src_ptr1 += 2;
2233 dst_ptr += 2; 2233 dst_ptr += 2;
2234 } 2234 }
2235 if (width & 1) { 2235 if (width & 1) {
2236 dst_ptr[0] = 2236 dst_ptr[0] =
2237 » » (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction + 64) >> 7 ; 2237 (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction + 128) >> 8;
2238 } 2238 }
2239 } 2239 }
2240 2240
2241 void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr, 2241 void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr,
2242 ptrdiff_t src_stride, 2242 ptrdiff_t src_stride,
2243 int width, int source_y_fraction) { 2243 int width, int source_y_fraction) {
2244 int y1_fraction = source_y_fraction; 2244 int y1_fraction = source_y_fraction;
2245 int y0_fraction = 256 - y1_fraction; 2245 int y0_fraction = 256 - y1_fraction;
2246 const uint16* src_ptr1 = src_ptr + src_stride; 2246 const uint16* src_ptr1 = src_ptr + src_stride;
2247 int x; 2247 int x;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 dst_rgb565 += twidth * 2; 2633 dst_rgb565 += twidth * 2;
2634 width -= twidth; 2634 width -= twidth;
2635 } 2635 }
2636 } 2636 }
2637 #endif 2637 #endif
2638 2638
2639 #ifdef __cplusplus 2639 #ifdef __cplusplus
2640 } // extern "C" 2640 } // extern "C"
2641 } // namespace libyuv 2641 } // namespace libyuv
2642 #endif 2642 #endif
OLDNEW
« no previous file with comments | « include/libyuv/version.h ('k') | source/row_gcc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698