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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 *(const uint32*)(src_argb + y * src_argb_stride + | 2223 *(const uint32*)(src_argb + y * src_argb_stride + |
2224 x * 4); | 2224 x * 4); |
2225 dst_argb += 4; | 2225 dst_argb += 4; |
2226 uv[0] += uv_dudv[2]; | 2226 uv[0] += uv_dudv[2]; |
2227 uv[1] += uv_dudv[3]; | 2227 uv[1] += uv_dudv[3]; |
2228 } | 2228 } |
2229 } | 2229 } |
2230 | 2230 |
2231 // Blend 2 rows into 1. | 2231 // Blend 2 rows into 1. |
2232 static void HalfRow_C(const uint8* src_uv, int src_uv_stride, | 2232 static void HalfRow_C(const uint8* src_uv, int src_uv_stride, |
2233 uint8* dst_uv, int pix) { | 2233 uint8* dst_uv, int width) { |
2234 int x; | 2234 int x; |
2235 for (x = 0; x < pix; ++x) { | 2235 for (x = 0; x < width; ++x) { |
2236 dst_uv[x] = (src_uv[x] + src_uv[src_uv_stride + x] + 1) >> 1; | 2236 dst_uv[x] = (src_uv[x] + src_uv[src_uv_stride + x] + 1) >> 1; |
2237 } | 2237 } |
2238 } | 2238 } |
2239 | 2239 |
2240 static void HalfRow_16_C(const uint16* src_uv, int src_uv_stride, | 2240 static void HalfRow_16_C(const uint16* src_uv, int src_uv_stride, |
2241 uint16* dst_uv, int pix) { | 2241 uint16* dst_uv, int width) { |
2242 int x; | 2242 int x; |
2243 for (x = 0; x < pix; ++x) { | 2243 for (x = 0; x < width; ++x) { |
2244 dst_uv[x] = (src_uv[x] + src_uv[src_uv_stride + x] + 1) >> 1; | 2244 dst_uv[x] = (src_uv[x] + src_uv[src_uv_stride + x] + 1) >> 1; |
2245 } | 2245 } |
2246 } | 2246 } |
2247 | 2247 |
2248 // C version 2x2 -> 2x1. | 2248 // C version 2x2 -> 2x1. |
2249 void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr, | 2249 void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr, |
2250 ptrdiff_t src_stride, | 2250 ptrdiff_t src_stride, |
2251 int width, int source_y_fraction) { | 2251 int width, int source_y_fraction) { |
2252 int y1_fraction = source_y_fraction; | 2252 int y1_fraction = source_y_fraction; |
2253 int y0_fraction = 256 - y1_fraction; | 2253 int y0_fraction = 256 - y1_fraction; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 src_ptr1 += 2; | 2295 src_ptr1 += 2; |
2296 dst_ptr += 2; | 2296 dst_ptr += 2; |
2297 } | 2297 } |
2298 if (width & 1) { | 2298 if (width & 1) { |
2299 dst_ptr[0] = (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction) >> 8; | 2299 dst_ptr[0] = (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction) >> 8; |
2300 } | 2300 } |
2301 } | 2301 } |
2302 | 2302 |
2303 // Use first 4 shuffler values to reorder ARGB channels. | 2303 // Use first 4 shuffler values to reorder ARGB channels. |
2304 void ARGBShuffleRow_C(const uint8* src_argb, uint8* dst_argb, | 2304 void ARGBShuffleRow_C(const uint8* src_argb, uint8* dst_argb, |
2305 const uint8* shuffler, int pix) { | 2305 const uint8* shuffler, int width) { |
2306 int index0 = shuffler[0]; | 2306 int index0 = shuffler[0]; |
2307 int index1 = shuffler[1]; | 2307 int index1 = shuffler[1]; |
2308 int index2 = shuffler[2]; | 2308 int index2 = shuffler[2]; |
2309 int index3 = shuffler[3]; | 2309 int index3 = shuffler[3]; |
2310 // Shuffle a row of ARGB. | 2310 // Shuffle a row of ARGB. |
2311 int x; | 2311 int x; |
2312 for (x = 0; x < pix; ++x) { | 2312 for (x = 0; x < width; ++x) { |
2313 // To support in-place conversion. | 2313 // To support in-place conversion. |
2314 uint8 b = src_argb[index0]; | 2314 uint8 b = src_argb[index0]; |
2315 uint8 g = src_argb[index1]; | 2315 uint8 g = src_argb[index1]; |
2316 uint8 r = src_argb[index2]; | 2316 uint8 r = src_argb[index2]; |
2317 uint8 a = src_argb[index3]; | 2317 uint8 a = src_argb[index3]; |
2318 dst_argb[0] = b; | 2318 dst_argb[0] = b; |
2319 dst_argb[1] = g; | 2319 dst_argb[1] = g; |
2320 dst_argb[2] = r; | 2320 dst_argb[2] = r; |
2321 dst_argb[3] = a; | 2321 dst_argb[3] = a; |
2322 src_argb += 4; | 2322 src_argb += 4; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 dst_rgb565 += twidth * 2; | 2691 dst_rgb565 += twidth * 2; |
2692 width -= twidth; | 2692 width -= twidth; |
2693 } | 2693 } |
2694 } | 2694 } |
2695 #endif | 2695 #endif |
2696 | 2696 |
2697 #ifdef __cplusplus | 2697 #ifdef __cplusplus |
2698 } // extern "C" | 2698 } // extern "C" |
2699 } // namespace libyuv | 2699 } // namespace libyuv |
2700 #endif | 2700 #endif |
OLD | NEW |