OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM 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 13 matching lines...) Expand all Loading... |
24 int i; | 24 int i; |
25 const int linesize = extend_left + extend_right + width; | 25 const int linesize = extend_left + extend_right + width; |
26 | 26 |
27 /* copy the left and right most columns out */ | 27 /* copy the left and right most columns out */ |
28 uint8_t *src_ptr1 = src; | 28 uint8_t *src_ptr1 = src; |
29 uint8_t *src_ptr2 = src + width - 1; | 29 uint8_t *src_ptr2 = src + width - 1; |
30 uint8_t *dst_ptr1 = src - extend_left; | 30 uint8_t *dst_ptr1 = src - extend_left; |
31 uint8_t *dst_ptr2 = src + width; | 31 uint8_t *dst_ptr2 = src + width; |
32 | 32 |
33 for (i = 0; i < height; ++i) { | 33 for (i = 0; i < height; ++i) { |
34 vpx_memset(dst_ptr1, src_ptr1[0], extend_left); | 34 memset(dst_ptr1, src_ptr1[0], extend_left); |
35 vpx_memset(dst_ptr2, src_ptr2[0], extend_right); | 35 memset(dst_ptr2, src_ptr2[0], extend_right); |
36 src_ptr1 += src_stride; | 36 src_ptr1 += src_stride; |
37 src_ptr2 += src_stride; | 37 src_ptr2 += src_stride; |
38 dst_ptr1 += src_stride; | 38 dst_ptr1 += src_stride; |
39 dst_ptr2 += src_stride; | 39 dst_ptr2 += src_stride; |
40 } | 40 } |
41 | 41 |
42 /* Now copy the top and bottom lines into each line of the respective | 42 /* Now copy the top and bottom lines into each line of the respective |
43 * borders | 43 * borders |
44 */ | 44 */ |
45 src_ptr1 = src - extend_left; | 45 src_ptr1 = src - extend_left; |
46 src_ptr2 = src + src_stride * (height - 1) - extend_left; | 46 src_ptr2 = src + src_stride * (height - 1) - extend_left; |
47 dst_ptr1 = src + src_stride * -extend_top - extend_left; | 47 dst_ptr1 = src + src_stride * -extend_top - extend_left; |
48 dst_ptr2 = src + src_stride * height - extend_left; | 48 dst_ptr2 = src + src_stride * height - extend_left; |
49 | 49 |
50 for (i = 0; i < extend_top; ++i) { | 50 for (i = 0; i < extend_top; ++i) { |
51 vpx_memcpy(dst_ptr1, src_ptr1, linesize); | 51 memcpy(dst_ptr1, src_ptr1, linesize); |
52 dst_ptr1 += src_stride; | 52 dst_ptr1 += src_stride; |
53 } | 53 } |
54 | 54 |
55 for (i = 0; i < extend_bottom; ++i) { | 55 for (i = 0; i < extend_bottom; ++i) { |
56 vpx_memcpy(dst_ptr2, src_ptr2, linesize); | 56 memcpy(dst_ptr2, src_ptr2, linesize); |
57 dst_ptr2 += src_stride; | 57 dst_ptr2 += src_stride; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH | 61 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH |
62 static void extend_plane_high(uint8_t *const src8, int src_stride, | 62 static void extend_plane_high(uint8_t *const src8, int src_stride, |
63 int width, int height, | 63 int width, int height, |
64 int extend_top, int extend_left, | 64 int extend_top, int extend_left, |
65 int extend_bottom, int extend_right) { | 65 int extend_bottom, int extend_right) { |
66 int i; | 66 int i; |
(...skipping 17 matching lines...) Expand all Loading... |
84 | 84 |
85 /* Now copy the top and bottom lines into each line of the respective | 85 /* Now copy the top and bottom lines into each line of the respective |
86 * borders | 86 * borders |
87 */ | 87 */ |
88 src_ptr1 = src - extend_left; | 88 src_ptr1 = src - extend_left; |
89 src_ptr2 = src + src_stride * (height - 1) - extend_left; | 89 src_ptr2 = src + src_stride * (height - 1) - extend_left; |
90 dst_ptr1 = src + src_stride * -extend_top - extend_left; | 90 dst_ptr1 = src + src_stride * -extend_top - extend_left; |
91 dst_ptr2 = src + src_stride * height - extend_left; | 91 dst_ptr2 = src + src_stride * height - extend_left; |
92 | 92 |
93 for (i = 0; i < extend_top; ++i) { | 93 for (i = 0; i < extend_top; ++i) { |
94 vpx_memcpy(dst_ptr1, src_ptr1, linesize * sizeof(uint16_t)); | 94 memcpy(dst_ptr1, src_ptr1, linesize * sizeof(uint16_t)); |
95 dst_ptr1 += src_stride; | 95 dst_ptr1 += src_stride; |
96 } | 96 } |
97 | 97 |
98 for (i = 0; i < extend_bottom; ++i) { | 98 for (i = 0; i < extend_bottom; ++i) { |
99 vpx_memcpy(dst_ptr2, src_ptr2, linesize * sizeof(uint16_t)); | 99 memcpy(dst_ptr2, src_ptr2, linesize * sizeof(uint16_t)); |
100 dst_ptr2 += src_stride; | 100 dst_ptr2 += src_stride; |
101 } | 101 } |
102 } | 102 } |
103 #endif | 103 #endif |
104 | 104 |
105 void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) { | 105 void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) { |
106 const int uv_border = ybf->border / 2; | 106 const int uv_border = ybf->border / 2; |
107 | 107 |
108 assert(ybf->border % 2 == 0); | 108 assert(ybf->border % 2 == 0); |
109 assert(ybf->y_height - ybf->y_crop_height < 16); | 109 assert(ybf->y_height - ybf->y_crop_height < 16); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void vp9_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) { | 205 void vp9_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) { |
206 const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ? | 206 const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ? |
207 VP9INNERBORDERINPIXELS : ybf->border; | 207 VP9INNERBORDERINPIXELS : ybf->border; |
208 extend_frame(ybf, inner_bw); | 208 extend_frame(ybf, inner_bw); |
209 } | 209 } |
210 | 210 |
211 #if CONFIG_VP9_HIGHBITDEPTH | 211 #if CONFIG_VP9_HIGHBITDEPTH |
212 void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) { | 212 void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) { |
213 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); | 213 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); |
214 uint16_t *src = CONVERT_TO_SHORTPTR(src8); | 214 uint16_t *src = CONVERT_TO_SHORTPTR(src8); |
215 vpx_memcpy(dst, src, num * sizeof(uint16_t)); | 215 memcpy(dst, src, num * sizeof(uint16_t)); |
216 } | 216 } |
217 #endif // CONFIG_VP9_HIGHBITDEPTH | 217 #endif // CONFIG_VP9_HIGHBITDEPTH |
218 #endif // CONFIG_VP9 | 218 #endif // CONFIG_VP9 |
219 | 219 |
220 // Copies the source image into the destination image and updates the | 220 // Copies the source image into the destination image and updates the |
221 // destination's UMV borders. | 221 // destination's UMV borders. |
222 // Note: The frames are assumed to be identical in size. | 222 // Note: The frames are assumed to be identical in size. |
223 void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc, | 223 void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc, |
224 YV12_BUFFER_CONFIG *dst_ybc) { | 224 YV12_BUFFER_CONFIG *dst_ybc) { |
225 int row; | 225 int row; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 | 263 |
264 vp8_yv12_extend_frame_borders_c(dst_ybc); | 264 vp8_yv12_extend_frame_borders_c(dst_ybc); |
265 return; | 265 return; |
266 } else { | 266 } else { |
267 assert(!(dst_ybc->flags & YV12_FLAG_HIGHBITDEPTH)); | 267 assert(!(dst_ybc->flags & YV12_FLAG_HIGHBITDEPTH)); |
268 } | 268 } |
269 #endif | 269 #endif |
270 | 270 |
271 for (row = 0; row < src_ybc->y_height; ++row) { | 271 for (row = 0; row < src_ybc->y_height; ++row) { |
272 vpx_memcpy(dst, src, src_ybc->y_width); | 272 memcpy(dst, src, src_ybc->y_width); |
273 src += src_ybc->y_stride; | 273 src += src_ybc->y_stride; |
274 dst += dst_ybc->y_stride; | 274 dst += dst_ybc->y_stride; |
275 } | 275 } |
276 | 276 |
277 src = src_ybc->u_buffer; | 277 src = src_ybc->u_buffer; |
278 dst = dst_ybc->u_buffer; | 278 dst = dst_ybc->u_buffer; |
279 | 279 |
280 for (row = 0; row < src_ybc->uv_height; ++row) { | 280 for (row = 0; row < src_ybc->uv_height; ++row) { |
281 vpx_memcpy(dst, src, src_ybc->uv_width); | 281 memcpy(dst, src, src_ybc->uv_width); |
282 src += src_ybc->uv_stride; | 282 src += src_ybc->uv_stride; |
283 dst += dst_ybc->uv_stride; | 283 dst += dst_ybc->uv_stride; |
284 } | 284 } |
285 | 285 |
286 src = src_ybc->v_buffer; | 286 src = src_ybc->v_buffer; |
287 dst = dst_ybc->v_buffer; | 287 dst = dst_ybc->v_buffer; |
288 | 288 |
289 for (row = 0; row < src_ybc->uv_height; ++row) { | 289 for (row = 0; row < src_ybc->uv_height; ++row) { |
290 vpx_memcpy(dst, src, src_ybc->uv_width); | 290 memcpy(dst, src, src_ybc->uv_width); |
291 src += src_ybc->uv_stride; | 291 src += src_ybc->uv_stride; |
292 dst += dst_ybc->uv_stride; | 292 dst += dst_ybc->uv_stride; |
293 } | 293 } |
294 | 294 |
295 vp8_yv12_extend_frame_borders_c(dst_ybc); | 295 vp8_yv12_extend_frame_borders_c(dst_ybc); |
296 } | 296 } |
297 | 297 |
298 void vpx_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc, | 298 void vpx_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc, |
299 YV12_BUFFER_CONFIG *dst_ybc) { | 299 YV12_BUFFER_CONFIG *dst_ybc) { |
300 int row; | 300 int row; |
301 const uint8_t *src = src_ybc->y_buffer; | 301 const uint8_t *src = src_ybc->y_buffer; |
302 uint8_t *dst = dst_ybc->y_buffer; | 302 uint8_t *dst = dst_ybc->y_buffer; |
303 | 303 |
304 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH | 304 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH |
305 if (src_ybc->flags & YV12_FLAG_HIGHBITDEPTH) { | 305 if (src_ybc->flags & YV12_FLAG_HIGHBITDEPTH) { |
306 const uint16_t *src16 = CONVERT_TO_SHORTPTR(src); | 306 const uint16_t *src16 = CONVERT_TO_SHORTPTR(src); |
307 uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst); | 307 uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst); |
308 for (row = 0; row < src_ybc->y_height; ++row) { | 308 for (row = 0; row < src_ybc->y_height; ++row) { |
309 vpx_memcpy(dst16, src16, src_ybc->y_width * sizeof(uint16_t)); | 309 memcpy(dst16, src16, src_ybc->y_width * sizeof(uint16_t)); |
310 src16 += src_ybc->y_stride; | 310 src16 += src_ybc->y_stride; |
311 dst16 += dst_ybc->y_stride; | 311 dst16 += dst_ybc->y_stride; |
312 } | 312 } |
313 return; | 313 return; |
314 } | 314 } |
315 #endif | 315 #endif |
316 | 316 |
317 for (row = 0; row < src_ybc->y_height; ++row) { | 317 for (row = 0; row < src_ybc->y_height; ++row) { |
318 vpx_memcpy(dst, src, src_ybc->y_width); | 318 memcpy(dst, src, src_ybc->y_width); |
319 src += src_ybc->y_stride; | 319 src += src_ybc->y_stride; |
320 dst += dst_ybc->y_stride; | 320 dst += dst_ybc->y_stride; |
321 } | 321 } |
322 } | 322 } |
OLD | NEW |