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 |
| 11 #include "vpx_mem/vpx_mem.h" |
| 12 |
| 13 #include "vp9/common/vp9_common.h" |
11 #include "vp9/common/vp9_extend.h" | 14 #include "vp9/common/vp9_extend.h" |
12 #include "vpx_mem/vpx_mem.h" | |
13 | 15 |
14 static void copy_and_extend_plane(const uint8_t *src, int src_pitch, | 16 static void copy_and_extend_plane(const uint8_t *src, int src_pitch, |
15 uint8_t *dst, int dst_pitch, | 17 uint8_t *dst, int dst_pitch, |
16 int w, int h, | 18 int w, int h, |
17 int extend_top, int extend_left, | 19 int extend_top, int extend_left, |
18 int extend_bottom, int extend_right) { | 20 int extend_bottom, int extend_right) { |
19 int i, linesize; | 21 int i, linesize; |
20 | 22 |
21 // copy the left and right most columns out | 23 // copy the left and right most columns out |
22 const uint8_t *src_ptr1 = src; | 24 const uint8_t *src_ptr1 = src; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // If the side is not touching the bounder then don't extend. | 102 // If the side is not touching the bounder then don't extend. |
101 const int et_y = srcy ? 0 : dst->border; | 103 const int et_y = srcy ? 0 : dst->border; |
102 const int el_y = srcx ? 0 : dst->border; | 104 const int el_y = srcx ? 0 : dst->border; |
103 const int eb_y = srcy + srch != src->y_height ? 0 : | 105 const int eb_y = srcy + srch != src->y_height ? 0 : |
104 dst->border + dst->y_height - src->y_height; | 106 dst->border + dst->y_height - src->y_height; |
105 const int er_y = srcx + srcw != src->y_width ? 0 : | 107 const int er_y = srcx + srcw != src->y_width ? 0 : |
106 dst->border + dst->y_width - src->y_width; | 108 dst->border + dst->y_width - src->y_width; |
107 const int src_y_offset = srcy * src->y_stride + srcx; | 109 const int src_y_offset = srcy * src->y_stride + srcx; |
108 const int dst_y_offset = srcy * dst->y_stride + srcx; | 110 const int dst_y_offset = srcy * dst->y_stride + srcx; |
109 | 111 |
110 const int et_uv = (et_y + 1) >> 1; | 112 const int et_uv = ROUND_POWER_OF_TWO(et_y, 1); |
111 const int el_uv = (el_y + 1) >> 1; | 113 const int el_uv = ROUND_POWER_OF_TWO(el_y, 1); |
112 const int eb_uv = (eb_y + 1) >> 1; | 114 const int eb_uv = ROUND_POWER_OF_TWO(eb_y, 1); |
113 const int er_uv = (er_y + 1) >> 1; | 115 const int er_uv = ROUND_POWER_OF_TWO(er_y, 1); |
114 const int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1); | 116 const int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1); |
115 const int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1); | 117 const int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1); |
116 const int srch_uv = (srch + 1) >> 1; | 118 const int srch_uv = ROUND_POWER_OF_TWO(srch, 1); |
117 const int srcw_uv = (srcw + 1) >> 1; | 119 const int srcw_uv = ROUND_POWER_OF_TWO(srcw, 1); |
118 | 120 |
119 copy_and_extend_plane(src->y_buffer + src_y_offset, src->y_stride, | 121 copy_and_extend_plane(src->y_buffer + src_y_offset, src->y_stride, |
120 dst->y_buffer + dst_y_offset, dst->y_stride, | 122 dst->y_buffer + dst_y_offset, dst->y_stride, |
121 srcw, srch, | 123 srcw, srch, |
122 et_y, el_y, eb_y, er_y); | 124 et_y, el_y, eb_y, er_y); |
123 | 125 |
124 copy_and_extend_plane(src->u_buffer + src_uv_offset, src->uv_stride, | 126 copy_and_extend_plane(src->u_buffer + src_uv_offset, src->uv_stride, |
125 dst->u_buffer + dst_uv_offset, dst->uv_stride, | 127 dst->u_buffer + dst_uv_offset, dst->uv_stride, |
126 srcw_uv, srch_uv, | 128 srcw_uv, srch_uv, |
127 et_uv, el_uv, eb_uv, er_uv); | 129 et_uv, el_uv, eb_uv, er_uv); |
128 | 130 |
129 copy_and_extend_plane(src->v_buffer + src_uv_offset, src->uv_stride, | 131 copy_and_extend_plane(src->v_buffer + src_uv_offset, src->uv_stride, |
130 dst->v_buffer + dst_uv_offset, dst->uv_stride, | 132 dst->v_buffer + dst_uv_offset, dst->uv_stride, |
131 srcw_uv, srch_uv, | 133 srcw_uv, srch_uv, |
132 et_uv, el_uv, eb_uv, er_uv); | 134 et_uv, el_uv, eb_uv, er_uv); |
133 } | 135 } |
OLD | NEW |