/src/libavc/common/svc/isvc_intra_resample.c
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Copyright (C) 2022 The Android Open Source Project |
4 | | * |
5 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | | * you may not use this file except in compliance with the License. |
7 | | * You may obtain a copy of the License at: |
8 | | * |
9 | | * http://www.apache.org/licenses/LICENSE-2.0 |
10 | | * |
11 | | * Unless required by applicable law or agreed to in writing, software |
12 | | * distributed under the License is distributed on an "AS IS" BASIS, |
13 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | * See the License for the specific language governing permissions and |
15 | | * limitations under the License. |
16 | | * |
17 | | ***************************************************************************** |
18 | | * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore |
19 | | */ |
20 | | /*! |
21 | | ************************************************************************** |
22 | | * \file isvcd_resamp_svc.c |
23 | | * |
24 | | * \brief |
25 | | * Contains routines that resample for SVC resampling |
26 | | * |
27 | | * Detailed_description |
28 | | * |
29 | | * \date |
30 | | * |
31 | | * |
32 | | * \author |
33 | | ************************************************************************** |
34 | | */ |
35 | | #include <assert.h> |
36 | | #include <string.h> |
37 | | |
38 | | #include "ih264_typedefs.h" |
39 | | #include "ih264_macros.h" |
40 | | #include "isvc_macros.h" |
41 | | #include "ih264_platform_macros.h" |
42 | | #include "isvc_intra_resample.h" |
43 | | #include "ih264_debug.h" |
44 | | #include "isvc_defs.h" |
45 | | #include "isvc_structs.h" |
46 | | |
47 | | #define NUM_SEGMENTS 16 |
48 | | #define NUM_INTRA_SAMP_FXNS 32 |
49 | | #define INTERPOL_FILTER_SIZE_LUMA 64 |
50 | | #define INTERPOL_FILTER_SIZE_CHROMA 32 |
51 | | |
52 | | typedef void(PF_INTRA_SAMP_PADDING)(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, WORD8 i1_yd_index, |
53 | | UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, UWORD8 *pu1_refarray_1, |
54 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
55 | | WORD32 i4_mb_adjoin_x, WORD32 i4_mb_adjoin_y, |
56 | | WORD32 i4_corner_pixel_available); |
57 | | |
58 | | static const WORD8 g_ai1_interp_filter_luma[INTERPOL_FILTER_SIZE_LUMA] = { |
59 | | 0, -1, -2, -3, -3, -4, -4, -3, -3, -3, -2, -1, -1, -1, -1, -1, 32, 32, 31, 30, 28, 26, |
60 | | 24, 22, 19, 16, 14, 11, 8, 6, 4, 2, 0, 2, 4, 6, 8, 11, 14, 16, 19, 22, 24, 26, |
61 | | 28, 30, 31, 32, 0, -1, -1, -1, -1, -1, -2, -3, -3, -3, -4, -4, -3, -3, -2, -1}; |
62 | | |
63 | | static const UWORD8 g_au1_interp_filter_chroma[INTERPOL_FILTER_SIZE_CHROMA] = { |
64 | | 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, |
65 | | 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}; |
66 | | |
67 | | static const UWORD32 gu4_valid_segs_lookup[NUM_SEGMENTS] = { |
68 | | 0x0F000000, 0xCF000000, 0x3F000000, 0xFF000000, 0x0F000000, 0xCF000000, 0x3F000000, 0xFF000000, |
69 | | 0x0F000000, 0x8F000000, 0x6F000000, 0xEF000000, 0x1F000000, 0x9F000000, 0x7F000000, 0xFF000000}; |
70 | | |
71 | | /*****************************************************************************/ |
72 | | /* */ |
73 | | /* Function Name : isvc_copy_data */ |
74 | | /* */ |
75 | | /* Description : this module copies the data from source to destination */ |
76 | | /* the amount of data to be copied is passed as input */ |
77 | | /* */ |
78 | | /* Inputs : pu1_src : pointer to the source buffer */ |
79 | | /* u2_src_stride : source buffer stride */ |
80 | | /* pu1_dst : pointer to the destination buffer */ |
81 | | /* u2_dst_stride : destination buffer stride */ |
82 | | /* u4_num_bytes : number of bytes to be copied */ |
83 | | /* u4_num_lines : number of lines to be copied */ |
84 | | /* Globals : none */ |
85 | | /* Processing : it does a memcpy from source to destination */ |
86 | | /* */ |
87 | | /* Outputs : none */ |
88 | | /* Returns : none */ |
89 | | /* Issues : both buffers are assumed to be 2-D buffers */ |
90 | | /* */ |
91 | | /* Revision History: */ |
92 | | /* */ |
93 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
94 | | /* 29 04 2009 vijayakumar creation */ |
95 | | /* */ |
96 | | /*****************************************************************************/ |
97 | | /** \brief performs the 2-D memory transfer */ |
98 | | static void isvc_copy_data(UWORD8 *pu1_src, WORD32 i4_src_stride, UWORD8 *pu1_dst, |
99 | | WORD32 i4_dst_stride, WORD32 i4_num_bytes, WORD32 i4_num_lines) |
100 | 5.54M | { |
101 | 5.54M | WORD32 i4_vert_lines; |
102 | 5.54M | ASSERT(NULL != pu1_src); |
103 | 5.54M | ASSERT(NULL != pu1_dst); |
104 | | |
105 | 115M | for(i4_vert_lines = 0; i4_vert_lines < i4_num_lines; i4_vert_lines++) |
106 | 110M | { |
107 | 110M | memcpy(pu1_dst, pu1_src, i4_num_bytes); |
108 | 110M | pu1_src += i4_src_stride; |
109 | 110M | pu1_dst += i4_dst_stride; |
110 | 110M | } |
111 | 5.54M | } |
112 | | |
113 | | static void isvc_copy_data_semiplanr(UWORD8 *pu1_src, WORD32 i4_src_stride, UWORD8 *pu1_dst1, |
114 | | UWORD8 *pu1_dst2, WORD32 i4_dst_stride, WORD32 i4_num_bytes, |
115 | | WORD32 i4_num_lines) |
116 | 5.58M | { |
117 | 5.58M | WORD32 i4_vert_lines, u4_i; |
118 | | |
119 | 5.58M | ASSERT(NULL != pu1_src); |
120 | 5.58M | ASSERT(NULL != pu1_dst1); |
121 | 5.57M | ASSERT(NULL != pu1_dst2); |
122 | | |
123 | 60.6M | for(i4_vert_lines = 0; i4_vert_lines < i4_num_lines; i4_vert_lines++) |
124 | 55.1M | { |
125 | 605M | for(u4_i = 0; u4_i < i4_num_bytes; u4_i++) |
126 | 550M | { |
127 | 550M | *(pu1_dst1 + u4_i) = *(pu1_src + (2 * u4_i)); |
128 | 550M | *(pu1_dst2 + u4_i) = *(pu1_src + (2 * u4_i) + 1); |
129 | 550M | } |
130 | 55.1M | pu1_src += i4_src_stride; |
131 | 55.1M | pu1_dst1 += i4_dst_stride; |
132 | 55.1M | pu1_dst2 += i4_dst_stride; |
133 | 55.1M | } |
134 | 5.57M | } |
135 | | |
136 | | static void isvc_left_right_padding(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, WORD8 i1_yd_index, |
137 | | UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, UWORD8 *pu1_refarray_1, |
138 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
139 | | WORD32 i4_mb_adjoin_x, WORD32 i4_mb_adjoin_y, |
140 | | WORD32 i4_corner_pixel_available) |
141 | 0 | { |
142 | 0 | WORD32 i4_idx_i; |
143 | 0 | UWORD8 *pu1_src, *pu1_dst; |
144 | |
|
145 | 0 | UNUSED(i1_yd_index); |
146 | 0 | UNUSED(pu1_refarray_2); |
147 | 0 | UNUSED(i4_mb_adjoin_x); |
148 | 0 | UNUSED(i4_mb_adjoin_y); |
149 | 0 | UNUSED(i4_corner_pixel_available); |
150 | |
|
151 | 0 | pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride); |
152 | 0 | pu1_src = pu1_dst + i1_xd_index; |
153 | |
|
154 | 0 | i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_LUMA); |
155 | 0 | u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_LUMA); |
156 | 0 | pu1_dst = pu1_src - i1_xd_index; |
157 | |
|
158 | 0 | for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++) |
159 | 0 | { |
160 | 0 | memset(pu1_dst, *pu1_src, u1_seg_wd); |
161 | 0 | pu1_dst += i4_refarray_stride; |
162 | 0 | pu1_src += i4_refarray_stride; |
163 | 0 | } |
164 | 0 | } |
165 | | |
166 | | static void isvc_left_right_padding_chroma(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, |
167 | | WORD8 i1_yd_index, UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, |
168 | | UWORD8 *pu1_refarray_1, UWORD8 *pu1_refarray_2, |
169 | | WORD32 i4_refarray_stride, WORD32 i4_mb_adjoin_x, |
170 | | WORD32 i4_mb_adjoin_y, WORD32 i4_corner_pixel_available) |
171 | 0 | { |
172 | 0 | WORD32 i4_idx_i; |
173 | 0 | UWORD8 *pu1_src_cb, *pu1_dst_cb; |
174 | 0 | UWORD8 *pu1_src_cr, *pu1_dst_cr; |
175 | 0 | WORD32 i4_tmp; |
176 | |
|
177 | 0 | UNUSED(i1_yd_index); |
178 | 0 | UNUSED(i4_mb_adjoin_x); |
179 | 0 | UNUSED(i4_mb_adjoin_y); |
180 | 0 | UNUSED(i4_corner_pixel_available); |
181 | |
|
182 | 0 | i4_tmp = i4_x + (i4_y * i4_refarray_stride); |
183 | 0 | pu1_dst_cb = pu1_refarray_1 + i4_tmp; |
184 | 0 | pu1_src_cb = pu1_dst_cb + i1_xd_index; |
185 | |
|
186 | 0 | pu1_dst_cr = pu1_refarray_2 + i4_tmp; |
187 | 0 | pu1_src_cr = pu1_dst_cr + i1_xd_index; |
188 | |
|
189 | 0 | i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_CHROMA); |
190 | 0 | u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_CHROMA); |
191 | 0 | pu1_dst_cb = pu1_src_cb - i1_xd_index; |
192 | 0 | pu1_dst_cr = pu1_src_cr - i1_xd_index; |
193 | |
|
194 | 0 | for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++) |
195 | 0 | { |
196 | 0 | memset(pu1_dst_cb, *pu1_src_cb, u1_seg_wd); |
197 | 0 | pu1_dst_cb += i4_refarray_stride; |
198 | 0 | pu1_src_cb += i4_refarray_stride; |
199 | |
|
200 | 0 | memset(pu1_dst_cr, *pu1_src_cr, u1_seg_wd); |
201 | 0 | pu1_dst_cr += i4_refarray_stride; |
202 | 0 | pu1_src_cr += i4_refarray_stride; |
203 | 0 | } |
204 | 0 | } |
205 | | |
206 | | static void isvc_top_bot_padding(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, WORD8 i1_yd_index, |
207 | | UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, UWORD8 *pu1_refarray_1, |
208 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
209 | | WORD32 i4_mb_adjoin_x, WORD32 i4_mb_adjoin_y, |
210 | | WORD32 i4_corner_pixel_available) |
211 | 0 | { |
212 | 0 | WORD32 i4_idx_i; |
213 | 0 | UWORD8 *pu1_src, *pu1_dst; |
214 | |
|
215 | 0 | UNUSED(i1_xd_index); |
216 | 0 | UNUSED(pu1_refarray_2); |
217 | 0 | UNUSED(i4_mb_adjoin_x); |
218 | 0 | UNUSED(i4_mb_adjoin_y); |
219 | 0 | UNUSED(i4_corner_pixel_available); |
220 | |
|
221 | 0 | pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride); |
222 | 0 | pu1_src = pu1_dst + (i1_yd_index * i4_refarray_stride); |
223 | |
|
224 | 0 | i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_LUMA); |
225 | 0 | u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_LUMA); |
226 | 0 | pu1_dst = pu1_src - (i1_yd_index * i4_refarray_stride); |
227 | |
|
228 | 0 | for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++) |
229 | 0 | { |
230 | 0 | memcpy(pu1_dst, pu1_src, u1_seg_wd); |
231 | 0 | pu1_dst += i4_refarray_stride; |
232 | 0 | } |
233 | 0 | } |
234 | | |
235 | | static void isvc_top_bot_padding_chroma(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, |
236 | | WORD8 i1_yd_index, UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, |
237 | | UWORD8 *pu1_refarray_1, UWORD8 *pu1_refarray_2, |
238 | | WORD32 i4_refarray_stride, WORD32 i4_mb_adjoin_x, |
239 | | WORD32 i4_mb_adjoin_y, WORD32 i4_corner_pixel_available) |
240 | 0 | { |
241 | 0 | WORD32 i4_idx_i; |
242 | 0 | UWORD8 *pu1_src_cb, *pu1_dst_cb; |
243 | 0 | UWORD8 *pu1_src_cr, *pu1_dst_cr; |
244 | 0 | WORD32 i4_tmp; |
245 | |
|
246 | 0 | UNUSED(i1_xd_index); |
247 | 0 | UNUSED(i4_mb_adjoin_x); |
248 | 0 | UNUSED(i4_mb_adjoin_y); |
249 | 0 | UNUSED(i4_corner_pixel_available); |
250 | |
|
251 | 0 | i4_tmp = i4_x + (i4_y * i4_refarray_stride); |
252 | 0 | pu1_dst_cb = pu1_refarray_1 + i4_tmp; |
253 | 0 | pu1_dst_cr = pu1_refarray_2 + i4_tmp; |
254 | |
|
255 | 0 | i4_tmp = (i1_yd_index * i4_refarray_stride); |
256 | 0 | pu1_src_cb = pu1_dst_cb + i4_tmp; |
257 | 0 | pu1_src_cr = pu1_dst_cr + i4_tmp; |
258 | |
|
259 | 0 | i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_CHROMA); |
260 | 0 | u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_CHROMA); |
261 | |
|
262 | 0 | i4_tmp = (i1_yd_index * i4_refarray_stride); |
263 | 0 | pu1_dst_cb = pu1_src_cb - i4_tmp; |
264 | |
|
265 | 0 | pu1_dst_cr = pu1_src_cr - i4_tmp; |
266 | |
|
267 | 0 | for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++) |
268 | 0 | { |
269 | 0 | memcpy(pu1_dst_cb, pu1_src_cb, u1_seg_wd); |
270 | 0 | pu1_dst_cb += i4_refarray_stride; |
271 | |
|
272 | 0 | memcpy(pu1_dst_cr, pu1_src_cr, u1_seg_wd); |
273 | 0 | pu1_dst_cr += i4_refarray_stride; |
274 | 0 | } |
275 | 0 | } |
276 | | |
277 | | static void isvc_diag_reconstruction(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, WORD8 i1_yd_index, |
278 | | UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, UWORD8 *pu1_refarray_1, |
279 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
280 | | WORD32 i4_mb_adjoin_x, WORD32 i4_mb_adjoin_y, |
281 | | WORD32 i4_corner_pixel_available) |
282 | 0 | { |
283 | 0 | WORD32 i4_i; |
284 | 0 | UWORD8 *pu1_src_1, *pu1_src_2, *pu1_dst; |
285 | 0 | UWORD8 u1_filter_delay_buf[18]; |
286 | 0 | UWORD8 u1_out_buf[16]; |
287 | 0 | WORD32 i4_width, i4_height; |
288 | 0 | WORD32 i4_x_off, i4_y_off; |
289 | 0 | WORD32 i4_block_size = BLK_SIZE; |
290 | |
|
291 | 0 | UNUSED(pu1_refarray_2); |
292 | |
|
293 | 0 | pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride); |
294 | 0 | pu1_src_1 = pu1_dst + i1_xd_index; |
295 | 0 | pu1_src_2 = pu1_dst + (i1_yd_index * i4_refarray_stride); |
296 | |
|
297 | 0 | i4_width = MAX(u1_seg_wd, (((i4_mb_adjoin_x >> 3) ^ 1) * i4_block_size)); |
298 | 0 | i4_height = MAX(u1_seg_ht, (((i4_mb_adjoin_y >> 4) ^ 1) * i4_block_size)); |
299 | |
|
300 | 0 | i4_x_off = (i4_width - u1_seg_wd); |
301 | 0 | i4_y_off = (i4_height - u1_seg_ht); |
302 | |
|
303 | 0 | if(i1_xd_index > 0 && i1_yd_index > 0) |
304 | 0 | { |
305 | | /* Quadrant 1 Processing */ |
306 | | |
307 | | /* load the pixel in the filter delay buffer */ |
308 | 0 | memcpy(&u1_filter_delay_buf[0], pu1_src_2, (i4_width + 1)); |
309 | 0 | for(i4_i = i4_height; i4_i > 0; i4_i--) |
310 | 0 | { |
311 | 0 | u1_filter_delay_buf[i4_width + i4_i] = *pu1_src_1; |
312 | 0 | pu1_src_1 += i4_refarray_stride; |
313 | 0 | } |
314 | |
|
315 | 0 | if(0 == i4_corner_pixel_available) |
316 | 0 | { |
317 | | /* interpolate the unavailable corner pixel */ |
318 | 0 | u1_filter_delay_buf[i4_width] = |
319 | 0 | (u1_filter_delay_buf[i4_width - 1] + u1_filter_delay_buf[i4_width + 1] + 1) >> 1; |
320 | 0 | } |
321 | |
|
322 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
323 | 0 | { |
324 | | /* get the filtered output */ |
325 | 0 | u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) + |
326 | 0 | (u1_filter_delay_buf[i4_i + 2]) + 2) >> |
327 | 0 | 2; |
328 | 0 | } |
329 | | |
330 | | /* fill the segment with diagonal reconstructed output */ |
331 | 0 | for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++) |
332 | 0 | { |
333 | 0 | memcpy(pu1_dst, &u1_out_buf[i4_height - i4_i], u1_seg_wd); |
334 | 0 | pu1_dst += i4_refarray_stride; |
335 | 0 | } |
336 | 0 | } |
337 | 0 | else if(i1_xd_index < 0 && i1_yd_index > 0) |
338 | 0 | { |
339 | | /* Quadrant 2 Processing */ |
340 | | /* load the pixel in the filter delay buffer */ |
341 | 0 | for(i4_i = 0; i4_i < (i4_height + 1); i4_i++) |
342 | 0 | { |
343 | 0 | u1_filter_delay_buf[i4_i] = *pu1_src_1; |
344 | 0 | pu1_src_1 += i4_refarray_stride; |
345 | 0 | } |
346 | |
|
347 | 0 | pu1_src_2 -= i4_x_off; |
348 | 0 | memcpy(&u1_filter_delay_buf[i4_i], pu1_src_2, i4_width); |
349 | |
|
350 | 0 | if(0 == i4_corner_pixel_available) |
351 | 0 | { |
352 | | /* interpolate the unavailable corner pixel */ |
353 | 0 | u1_filter_delay_buf[i4_i - 1] = |
354 | 0 | (u1_filter_delay_buf[i4_i] + u1_filter_delay_buf[i4_i - 2] + 1) >> 1; |
355 | 0 | } |
356 | |
|
357 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
358 | 0 | { |
359 | | /* get the filtered output */ |
360 | 0 | u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) + |
361 | 0 | (u1_filter_delay_buf[i4_i + 2]) + 2) >> |
362 | 0 | 2; |
363 | 0 | } |
364 | | |
365 | | /* fill the segment with diagonal reconstructed output */ |
366 | 0 | for(i4_i = 0; i4_i < u1_seg_ht; i4_i++) |
367 | 0 | { |
368 | 0 | memcpy(pu1_dst, &u1_out_buf[i4_x_off + i4_i], u1_seg_wd); |
369 | 0 | pu1_dst += i4_refarray_stride; |
370 | 0 | } |
371 | 0 | } |
372 | 0 | else if(i1_xd_index > 0 && i1_yd_index < 0) |
373 | 0 | { |
374 | | /* Quadrant 3 Processing */ |
375 | | /* load the pixel in the filter delay buffer */ |
376 | 0 | memcpy(&u1_filter_delay_buf[0], pu1_src_2, (i4_width + 1)); |
377 | |
|
378 | 0 | pu1_src_1 -= (i4_y_off * i4_refarray_stride); |
379 | 0 | for(i4_i = 1; i4_i <= i4_height; i4_i++) |
380 | 0 | { |
381 | 0 | u1_filter_delay_buf[i4_width + i4_i] = *pu1_src_1; |
382 | 0 | pu1_src_1 += i4_refarray_stride; |
383 | 0 | } |
384 | |
|
385 | 0 | if(0 == i4_corner_pixel_available) |
386 | 0 | { |
387 | | /* interpolate the unavailable corner pixel */ |
388 | 0 | u1_filter_delay_buf[i4_width] = |
389 | 0 | (u1_filter_delay_buf[i4_width - 1] + u1_filter_delay_buf[i4_width + 1] + 1) >> 1; |
390 | 0 | } |
391 | |
|
392 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
393 | 0 | { |
394 | | /* get the filtered output */ |
395 | 0 | u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) + |
396 | 0 | (u1_filter_delay_buf[i4_i + 2]) + 2) >> |
397 | 0 | 2; |
398 | 0 | } |
399 | | |
400 | | /* fill the segment with diagonal reconstructed output */ |
401 | 0 | for(i4_i = 0; i4_i < u1_seg_ht; i4_i++) |
402 | 0 | { |
403 | 0 | memcpy(pu1_dst, &u1_out_buf[i4_y_off + i4_i], u1_seg_wd); |
404 | 0 | pu1_dst += i4_refarray_stride; |
405 | 0 | } |
406 | 0 | } |
407 | 0 | else |
408 | 0 | { |
409 | | /* Quadrant 4 Processing */ |
410 | | /* load the pixel in the filter delay buffer */ |
411 | 0 | pu1_src_1 += ((u1_seg_ht - 1) * i4_refarray_stride); |
412 | 0 | for(i4_i = 0; i4_i <= i4_height; i4_i++) |
413 | 0 | { |
414 | 0 | u1_filter_delay_buf[i4_i] = *pu1_src_1; |
415 | 0 | pu1_src_1 -= i4_refarray_stride; |
416 | 0 | } |
417 | |
|
418 | 0 | pu1_src_2 -= i4_x_off; |
419 | 0 | memcpy(&u1_filter_delay_buf[i4_i], pu1_src_2, i4_width); |
420 | |
|
421 | 0 | if(0 == i4_corner_pixel_available) |
422 | 0 | { |
423 | | /* interpolate the unavailable corner pixel */ |
424 | 0 | u1_filter_delay_buf[i4_i - 1] = |
425 | 0 | (u1_filter_delay_buf[i4_i] + u1_filter_delay_buf[i4_i - 2] + 1) >> 1; |
426 | 0 | } |
427 | |
|
428 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
429 | 0 | { |
430 | | /* get the filtered output */ |
431 | 0 | u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) + |
432 | 0 | (u1_filter_delay_buf[i4_i + 2]) + 2) >> |
433 | 0 | 2; |
434 | 0 | } |
435 | | |
436 | | /* fill the segment with diagonal reconstructed output */ |
437 | 0 | for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++) |
438 | 0 | { |
439 | 0 | memcpy(pu1_dst, &u1_out_buf[(u1_seg_ht + i4_x_off) - i4_i], u1_seg_wd); |
440 | 0 | pu1_dst += i4_refarray_stride; |
441 | 0 | } |
442 | 0 | } |
443 | 0 | } |
444 | | |
445 | | static void isvc_diag_reconstruction_chroma(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, |
446 | | WORD8 i1_yd_index, UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, |
447 | | UWORD8 *pu1_refarray_1, UWORD8 *pu1_refarray_2, |
448 | | WORD32 i4_refarray_stride, WORD32 i4_mb_adjoin_x, |
449 | | WORD32 i4_mb_adjoin_y, WORD32 i4_corner_pixel_available) |
450 | 0 | { |
451 | 0 | WORD32 i4_i; |
452 | 0 | UWORD8 u1_filter_delay_buf_cb[18], u1_filter_delay_buf_cr[18]; |
453 | 0 | UWORD8 u1_out_buf_cb[16], u1_out_buf_cr[16]; |
454 | 0 | WORD32 i4_width, i4_height; |
455 | 0 | WORD32 i4_x_off, i4_y_off; |
456 | 0 | WORD32 i4_block_size = BLK_SIZE >> 1; |
457 | 0 | UWORD8 *pu1_src_1_cb, *pu1_src_2_cb, *pu1_dst_cb; |
458 | 0 | UWORD8 *pu1_src_1_cr, *pu1_src_2_cr, *pu1_dst_cr; |
459 | 0 | WORD32 i4_tmp; |
460 | |
|
461 | 0 | i4_tmp = i4_x + (i4_y * i4_refarray_stride); |
462 | 0 | pu1_dst_cb = pu1_refarray_1 + i4_tmp; |
463 | 0 | pu1_dst_cr = pu1_refarray_2 + i4_tmp; |
464 | |
|
465 | 0 | pu1_src_1_cb = pu1_dst_cb + i1_xd_index; |
466 | 0 | pu1_src_1_cr = pu1_dst_cr + i1_xd_index; |
467 | |
|
468 | 0 | i4_tmp = (i1_yd_index * i4_refarray_stride); |
469 | 0 | pu1_src_2_cb = pu1_dst_cb + i4_tmp; |
470 | 0 | pu1_src_2_cr = pu1_dst_cr + i4_tmp; |
471 | |
|
472 | 0 | i4_width = MAX(u1_seg_wd, (((i4_mb_adjoin_x >> 3) ^ 1) * i4_block_size)); |
473 | 0 | i4_height = MAX(u1_seg_ht, (((i4_mb_adjoin_y >> 4) ^ 1) * i4_block_size)); |
474 | |
|
475 | 0 | i4_x_off = (i4_width - u1_seg_wd); |
476 | 0 | i4_y_off = (i4_height - u1_seg_ht); |
477 | |
|
478 | 0 | if(i1_xd_index < 0 && i1_yd_index > 0) |
479 | 0 | { |
480 | | /* Quadrant 1 Processing */ |
481 | | |
482 | | /* load the pixel in the filter delay buffer */ |
483 | 0 | for(i4_i = 0; i4_i < (i4_height + 1); i4_i++) |
484 | 0 | { |
485 | 0 | u1_filter_delay_buf_cb[i4_i] = *pu1_src_1_cb; |
486 | 0 | pu1_src_1_cb += i4_refarray_stride; |
487 | |
|
488 | 0 | u1_filter_delay_buf_cr[i4_i] = *pu1_src_1_cr; |
489 | 0 | pu1_src_1_cr += i4_refarray_stride; |
490 | 0 | } |
491 | |
|
492 | 0 | pu1_src_2_cb -= i4_x_off; |
493 | 0 | pu1_src_2_cr -= i4_x_off; |
494 | |
|
495 | 0 | memcpy(&u1_filter_delay_buf_cb[i4_i], pu1_src_2_cb, i4_width); |
496 | 0 | memcpy(&u1_filter_delay_buf_cr[i4_i], pu1_src_2_cr, i4_width); |
497 | |
|
498 | 0 | if(0 == i4_corner_pixel_available) |
499 | 0 | { |
500 | | /* interpolate the unavailable corner pixel */ |
501 | 0 | u1_filter_delay_buf_cb[i4_i - 1] = |
502 | 0 | (u1_filter_delay_buf_cb[i4_i] + u1_filter_delay_buf_cb[i4_i - 2] + 1) >> 1; |
503 | |
|
504 | 0 | u1_filter_delay_buf_cr[i4_i - 1] = |
505 | 0 | (u1_filter_delay_buf_cr[i4_i] + u1_filter_delay_buf_cr[i4_i - 2] + 1) >> 1; |
506 | 0 | } |
507 | |
|
508 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
509 | 0 | { |
510 | | /* get the filtered output */ |
511 | 0 | u1_out_buf_cb[i4_i] = |
512 | 0 | ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) + |
513 | 0 | (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >> |
514 | 0 | 2; |
515 | |
|
516 | 0 | u1_out_buf_cr[i4_i] = |
517 | 0 | ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) + |
518 | 0 | (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >> |
519 | 0 | 2; |
520 | 0 | } |
521 | | |
522 | | /* fill the segment with diagonal reconstructed output */ |
523 | 0 | for(i4_i = 0; i4_i < u1_seg_ht; i4_i++) |
524 | 0 | { |
525 | 0 | memcpy(pu1_dst_cb, &u1_out_buf_cb[i4_x_off + i4_i], u1_seg_wd); |
526 | 0 | pu1_dst_cb += i4_refarray_stride; |
527 | |
|
528 | 0 | memcpy(pu1_dst_cr, &u1_out_buf_cr[i4_x_off + i4_i], u1_seg_wd); |
529 | 0 | pu1_dst_cr += i4_refarray_stride; |
530 | 0 | } |
531 | 0 | } |
532 | 0 | else if(i1_xd_index > 0 && i1_yd_index > 0) |
533 | 0 | { |
534 | | /* Quadrant 2 Processing */ |
535 | | |
536 | | /* load the pixel in the filter delay buffer */ |
537 | 0 | memcpy(&u1_filter_delay_buf_cb[0], pu1_src_2_cb, (i4_width + 1)); |
538 | 0 | memcpy(&u1_filter_delay_buf_cr[0], pu1_src_2_cr, (i4_width + 1)); |
539 | |
|
540 | 0 | for(i4_i = i4_height; i4_i > 0; i4_i--) |
541 | 0 | { |
542 | 0 | u1_filter_delay_buf_cb[i4_width + i4_i] = *pu1_src_1_cb; |
543 | 0 | pu1_src_1_cb += i4_refarray_stride; |
544 | |
|
545 | 0 | u1_filter_delay_buf_cr[i4_width + i4_i] = *pu1_src_1_cr; |
546 | 0 | pu1_src_1_cr += i4_refarray_stride; |
547 | 0 | } |
548 | |
|
549 | 0 | if(0 == i4_corner_pixel_available) |
550 | 0 | { |
551 | | /* interpolate the unavailable corner pixel */ |
552 | 0 | u1_filter_delay_buf_cb[i4_width] = |
553 | 0 | (u1_filter_delay_buf_cb[i4_width - 1] + u1_filter_delay_buf_cb[i4_width + 1] + 1) >> |
554 | 0 | 1; |
555 | |
|
556 | 0 | u1_filter_delay_buf_cr[i4_width] = |
557 | 0 | (u1_filter_delay_buf_cr[i4_width - 1] + u1_filter_delay_buf_cr[i4_width + 1] + 1) >> |
558 | 0 | 1; |
559 | 0 | } |
560 | |
|
561 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
562 | 0 | { |
563 | | /* get the filtered output */ |
564 | 0 | u1_out_buf_cb[i4_i] = |
565 | 0 | ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) + |
566 | 0 | (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >> |
567 | 0 | 2; |
568 | |
|
569 | 0 | u1_out_buf_cr[i4_i] = |
570 | 0 | ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) + |
571 | 0 | (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >> |
572 | 0 | 2; |
573 | 0 | } |
574 | | |
575 | | /* fill the segment with diagonal reconstructed output */ |
576 | 0 | for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++) |
577 | 0 | { |
578 | 0 | memcpy(pu1_dst_cb, &u1_out_buf_cb[i4_height - i4_i], u1_seg_wd); |
579 | 0 | pu1_dst_cb += i4_refarray_stride; |
580 | |
|
581 | 0 | memcpy(pu1_dst_cr, &u1_out_buf_cr[i4_height - i4_i], u1_seg_wd); |
582 | 0 | pu1_dst_cr += i4_refarray_stride; |
583 | 0 | } |
584 | 0 | } |
585 | 0 | else if(i1_xd_index > 0 && i1_yd_index < 0) |
586 | 0 | { |
587 | | /* Quadrant 3 Processing */ |
588 | | |
589 | | /* load the pixel in the filter delay buffer */ |
590 | 0 | memcpy(&u1_filter_delay_buf_cb[0], pu1_src_2_cb, (i4_width + 1)); |
591 | 0 | memcpy(&u1_filter_delay_buf_cr[0], pu1_src_2_cr, (i4_width + 1)); |
592 | |
|
593 | 0 | i4_tmp = (i4_y_off * i4_refarray_stride); |
594 | 0 | pu1_src_1_cb -= i4_tmp; |
595 | 0 | pu1_src_1_cr -= i4_tmp; |
596 | 0 | for(i4_i = 1; i4_i <= i4_height; i4_i++) |
597 | 0 | { |
598 | 0 | u1_filter_delay_buf_cb[i4_width + i4_i] = *pu1_src_1_cb; |
599 | 0 | pu1_src_1_cb += i4_refarray_stride; |
600 | |
|
601 | 0 | u1_filter_delay_buf_cr[i4_width + i4_i] = *pu1_src_1_cr; |
602 | 0 | pu1_src_1_cr += i4_refarray_stride; |
603 | 0 | } |
604 | |
|
605 | 0 | if(0 == i4_corner_pixel_available) |
606 | 0 | { |
607 | | /* interpolate the unavailable corner pixel */ |
608 | 0 | u1_filter_delay_buf_cb[i4_width] = |
609 | 0 | (u1_filter_delay_buf_cb[i4_width - 1] + u1_filter_delay_buf_cb[i4_width + 1] + 1) >> |
610 | 0 | 1; |
611 | |
|
612 | 0 | u1_filter_delay_buf_cr[i4_width] = |
613 | 0 | (u1_filter_delay_buf_cr[i4_width - 1] + u1_filter_delay_buf_cr[i4_width + 1] + 1) >> |
614 | 0 | 1; |
615 | 0 | } |
616 | |
|
617 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
618 | 0 | { |
619 | | /* get the filtered output */ |
620 | 0 | u1_out_buf_cb[i4_i] = |
621 | 0 | ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) + |
622 | 0 | (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >> |
623 | 0 | 2; |
624 | |
|
625 | 0 | u1_out_buf_cr[i4_i] = |
626 | 0 | ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) + |
627 | 0 | (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >> |
628 | 0 | 2; |
629 | 0 | } |
630 | | |
631 | | /* fill the segment with diagonal reconstructed output */ |
632 | 0 | for(i4_i = 0; i4_i < u1_seg_ht; i4_i++) |
633 | 0 | { |
634 | 0 | memcpy(pu1_dst_cb, &u1_out_buf_cb[i4_y_off + i4_i], u1_seg_wd); |
635 | 0 | pu1_dst_cb += i4_refarray_stride; |
636 | |
|
637 | 0 | memcpy(pu1_dst_cr, &u1_out_buf_cr[i4_y_off + i4_i], u1_seg_wd); |
638 | 0 | pu1_dst_cr += i4_refarray_stride; |
639 | 0 | } |
640 | 0 | } |
641 | 0 | else |
642 | 0 | { |
643 | | /* Quadrant 4 Processing */ |
644 | | |
645 | | /* load the pixel in the filter delay buffer */ |
646 | 0 | i4_tmp = ((u1_seg_ht - 1) * i4_refarray_stride); |
647 | 0 | pu1_src_1_cb += i4_tmp; |
648 | 0 | pu1_src_1_cr += i4_tmp; |
649 | |
|
650 | 0 | for(i4_i = 0; i4_i <= i4_height; i4_i++) |
651 | 0 | { |
652 | 0 | u1_filter_delay_buf_cb[i4_i] = *pu1_src_1_cb; |
653 | 0 | pu1_src_1_cb -= i4_refarray_stride; |
654 | |
|
655 | 0 | u1_filter_delay_buf_cr[i4_i] = *pu1_src_1_cr; |
656 | 0 | pu1_src_1_cr -= i4_refarray_stride; |
657 | 0 | } |
658 | |
|
659 | 0 | pu1_src_2_cb -= i4_x_off; |
660 | 0 | pu1_src_2_cr -= i4_x_off; |
661 | |
|
662 | 0 | memcpy(&u1_filter_delay_buf_cb[i4_i], pu1_src_2_cb, i4_width); |
663 | 0 | memcpy(&u1_filter_delay_buf_cr[i4_i], pu1_src_2_cr, i4_width); |
664 | |
|
665 | 0 | if(0 == i4_corner_pixel_available) |
666 | 0 | { |
667 | | /* interpolate the unavailable corner pixel */ |
668 | 0 | u1_filter_delay_buf_cb[i4_i - 1] = |
669 | 0 | (u1_filter_delay_buf_cb[i4_i] + u1_filter_delay_buf_cb[i4_i - 2] + 1) >> 1; |
670 | |
|
671 | 0 | u1_filter_delay_buf_cr[i4_i - 1] = |
672 | 0 | (u1_filter_delay_buf_cr[i4_i] + u1_filter_delay_buf_cr[i4_i - 2] + 1) >> 1; |
673 | 0 | } |
674 | |
|
675 | 0 | for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++) |
676 | 0 | { |
677 | | /* get the filtered output */ |
678 | 0 | u1_out_buf_cb[i4_i] = |
679 | 0 | ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) + |
680 | 0 | (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >> |
681 | 0 | 2; |
682 | |
|
683 | 0 | u1_out_buf_cr[i4_i] = |
684 | 0 | ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) + |
685 | 0 | (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >> |
686 | 0 | 2; |
687 | 0 | } |
688 | | |
689 | | /* fill the segment with diagonal reconstructed output */ |
690 | 0 | for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++) |
691 | 0 | { |
692 | 0 | memcpy(pu1_dst_cb, &u1_out_buf_cb[(u1_seg_ht + i4_x_off) - i4_i], u1_seg_wd); |
693 | 0 | pu1_dst_cb += i4_refarray_stride; |
694 | |
|
695 | 0 | memcpy(pu1_dst_cr, &u1_out_buf_cr[(u1_seg_ht + i4_x_off) - i4_i], u1_seg_wd); |
696 | 0 | pu1_dst_cr += i4_refarray_stride; |
697 | 0 | } |
698 | 0 | } |
699 | 0 | } |
700 | | |
701 | | static void isvc_diag_padding(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, WORD8 i1_yd_index, |
702 | | UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, UWORD8 *pu1_refarray_1, |
703 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
704 | | WORD32 i4_mb_adjoin_x, WORD32 i4_mb_adjoin_y, |
705 | | WORD32 i4_corner_pixel_available) |
706 | | |
707 | 0 | { |
708 | 0 | WORD32 i4_idx_i; |
709 | 0 | UWORD8 *pu1_src, *pu1_dst; |
710 | |
|
711 | 0 | UNUSED(pu1_refarray_2); |
712 | 0 | UNUSED(i4_mb_adjoin_x); |
713 | 0 | UNUSED(i4_mb_adjoin_y); |
714 | 0 | UNUSED(i4_corner_pixel_available); |
715 | |
|
716 | 0 | pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride); |
717 | 0 | pu1_src = pu1_dst + i1_xd_index + (i1_yd_index * i4_refarray_stride); |
718 | |
|
719 | 0 | i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_LUMA); |
720 | 0 | u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_LUMA); |
721 | |
|
722 | 0 | i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_LUMA); |
723 | 0 | u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_LUMA); |
724 | 0 | pu1_dst = pu1_src - i1_xd_index - (i1_yd_index * i4_refarray_stride); |
725 | |
|
726 | 0 | for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++) |
727 | 0 | { |
728 | 0 | memset(pu1_dst, *pu1_src, u1_seg_wd); |
729 | 0 | pu1_dst += i4_refarray_stride; |
730 | 0 | } |
731 | 0 | } |
732 | | |
733 | | static void isvc_diag_padding_chroma(WORD32 i4_x, WORD32 i4_y, WORD8 i1_xd_index, WORD8 i1_yd_index, |
734 | | UWORD8 u1_seg_wd, UWORD8 u1_seg_ht, UWORD8 *pu1_refarray_1, |
735 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
736 | | WORD32 i4_mb_adjoin_x, WORD32 i4_mb_adjoin_y, |
737 | | WORD32 i4_corner_pixel_available) |
738 | 0 | { |
739 | 0 | WORD32 i4_idx_i; |
740 | 0 | UWORD8 *pu1_src_cb, *pu1_dst_cb; |
741 | 0 | UWORD8 *pu1_src_cr, *pu1_dst_cr; |
742 | 0 | WORD32 i4_tmp; |
743 | |
|
744 | 0 | UNUSED(i4_mb_adjoin_x); |
745 | 0 | UNUSED(i4_mb_adjoin_y); |
746 | 0 | UNUSED(i4_corner_pixel_available); |
747 | |
|
748 | 0 | i4_tmp = i4_x + (i4_y * i4_refarray_stride); |
749 | 0 | pu1_dst_cb = pu1_refarray_1 + i4_tmp; |
750 | 0 | pu1_dst_cr = pu1_refarray_2 + i4_tmp; |
751 | |
|
752 | 0 | i4_tmp = i1_xd_index + (i1_yd_index * i4_refarray_stride); |
753 | 0 | pu1_src_cb = pu1_dst_cb + i4_tmp; |
754 | 0 | pu1_src_cr = pu1_dst_cr + i4_tmp; |
755 | |
|
756 | 0 | i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_LUMA); |
757 | 0 | u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_LUMA); |
758 | |
|
759 | 0 | i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_LUMA); |
760 | 0 | u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_LUMA); |
761 | |
|
762 | 0 | i4_tmp = (i1_xd_index + (i1_yd_index * i4_refarray_stride)); |
763 | 0 | pu1_dst_cb = pu1_src_cb - i4_tmp; |
764 | 0 | pu1_dst_cr = pu1_src_cr - i4_tmp; |
765 | |
|
766 | 0 | for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++) |
767 | 0 | { |
768 | 0 | memset(pu1_dst_cb, *pu1_src_cb, u1_seg_wd); |
769 | 0 | pu1_dst_cb += i4_refarray_stride; |
770 | |
|
771 | 0 | memset(pu1_dst_cr, *pu1_src_cr, u1_seg_wd); |
772 | 0 | pu1_dst_cr += i4_refarray_stride; |
773 | 0 | } |
774 | 0 | } |
775 | | |
776 | | static PF_INTRA_SAMP_PADDING *gpf_lookup_fxns_luma[NUM_INTRA_SAMP_FXNS] = { |
777 | | NULL, |
778 | | NULL, |
779 | | NULL, |
780 | | NULL, |
781 | | NULL, |
782 | | NULL, |
783 | | NULL, |
784 | | NULL, |
785 | | NULL, |
786 | | &isvc_left_right_padding, |
787 | | NULL, |
788 | | &isvc_diag_reconstruction, |
789 | | NULL, |
790 | | &isvc_left_right_padding, |
791 | | NULL, |
792 | | &isvc_diag_reconstruction, |
793 | | NULL, |
794 | | NULL, |
795 | | &isvc_top_bot_padding, |
796 | | &isvc_diag_reconstruction, |
797 | | NULL, |
798 | | NULL, |
799 | | &isvc_top_bot_padding, |
800 | | &isvc_diag_reconstruction, |
801 | | NULL, |
802 | | &isvc_left_right_padding, |
803 | | &isvc_top_bot_padding, |
804 | | &isvc_diag_reconstruction, |
805 | | &isvc_diag_padding, |
806 | | &isvc_left_right_padding, |
807 | | &isvc_top_bot_padding, |
808 | | &isvc_diag_reconstruction, |
809 | | }; |
810 | | |
811 | | static PF_INTRA_SAMP_PADDING *gpf_lookup_fxns_chroma[NUM_INTRA_SAMP_FXNS] = { |
812 | | NULL, |
813 | | NULL, |
814 | | NULL, |
815 | | NULL, |
816 | | NULL, |
817 | | NULL, |
818 | | NULL, |
819 | | NULL, |
820 | | NULL, |
821 | | &isvc_left_right_padding_chroma, |
822 | | NULL, |
823 | | &isvc_diag_reconstruction_chroma, |
824 | | NULL, |
825 | | &isvc_left_right_padding_chroma, |
826 | | NULL, |
827 | | &isvc_diag_reconstruction_chroma, |
828 | | NULL, |
829 | | NULL, |
830 | | &isvc_top_bot_padding_chroma, |
831 | | &isvc_diag_reconstruction_chroma, |
832 | | NULL, |
833 | | NULL, |
834 | | &isvc_top_bot_padding_chroma, |
835 | | &isvc_diag_reconstruction_chroma, |
836 | | NULL, |
837 | | &isvc_left_right_padding_chroma, |
838 | | &isvc_top_bot_padding_chroma, |
839 | | &isvc_diag_reconstruction_chroma, |
840 | | &isvc_diag_padding_chroma, |
841 | | &isvc_left_right_padding_chroma, |
842 | | &isvc_top_bot_padding_chroma, |
843 | | &isvc_diag_reconstruction_chroma, |
844 | | }; |
845 | | |
846 | | static void isvc_get_ref_layer_avlblty_dyadic(WORD8 *pi1_ref_mb_modes, WORD32 i4_ref_mode_stride, |
847 | | WORD32 i4_element_size, WORD32 i4_ref_mb_x, |
848 | | WORD32 i4_ref_mb_y, WORD32 *pi4_avlblty, |
849 | | WORD8 i1_curr_slice_id, WORD8 i1_cons_intr_samp_flag) |
850 | 27.9M | { |
851 | 27.9M | WORD8 i1_mb_mode; |
852 | | |
853 | 27.9M | pi1_ref_mb_modes += (i4_ref_mb_y * i4_ref_mode_stride * i4_element_size); |
854 | 27.9M | pi1_ref_mb_modes += (i4_ref_mb_x * i4_element_size); |
855 | 27.9M | i1_mb_mode = *pi1_ref_mb_modes; |
856 | 27.9M | i1_mb_mode = (i1_mb_mode < 0) ? i1_mb_mode : SVC_EXTRACT_MB_MODE(*pi1_ref_mb_modes); |
857 | | |
858 | 27.9M | if(i1_mb_mode <= SVC_INTER_MB) |
859 | 0 | { |
860 | 0 | *pi4_avlblty = 0; |
861 | 0 | } |
862 | 27.9M | else |
863 | 27.9M | { |
864 | 27.9M | *pi4_avlblty = 1; |
865 | 27.9M | } |
866 | | |
867 | 27.9M | if(1 == i1_cons_intr_samp_flag) |
868 | 0 | { |
869 | 0 | if(1 == *pi4_avlblty) |
870 | 0 | { |
871 | 0 | if(i1_mb_mode != i1_curr_slice_id) |
872 | 0 | { |
873 | 0 | *pi4_avlblty = 0; |
874 | 0 | } |
875 | 0 | } |
876 | 0 | } |
877 | 27.9M | } |
878 | | |
879 | | /*****************************************************************************/ |
880 | | /* */ |
881 | | /* Function Name : isvc_diagonal_construct_dyadic */ |
882 | | /* */ |
883 | | /* Description : This function fills the unavaible pixels in the reference*/ |
884 | | /* array with diagonally constructed samples */ |
885 | | /* Inputs : i4_x :current position in reference array X to be filled */ |
886 | | /* i4_y :current position in reference array Y to be filled */ |
887 | | /* i4_xd_index : diagonal index in horizontal direction */ |
888 | | /* i4_yd_index : diagonal index in vertical direction */ |
889 | | /* pu1_refarray : popinter to reference array */ |
890 | | /* i4_refarray_wd: width of the reference array */ |
891 | | /* Globals : none */ |
892 | | /* Processing : Fills the sample which is unavailable with filtered */ |
893 | | /* diagonal samples */ |
894 | | /* Outputs : pixel filled */ |
895 | | /* Returns : constructed pixel */ |
896 | | /* */ |
897 | | /* Issues : none */ |
898 | | /* */ |
899 | | /* Revision History: */ |
900 | | /* */ |
901 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
902 | | /* 03 12 2010 Nithya creation */ |
903 | | /* */ |
904 | | /*****************************************************************************/ |
905 | | static UWORD8 isvc_diagonal_construct_dyadic(WORD32 i4_x, WORD32 i4_y, WORD32 i4_xd_index, |
906 | | WORD32 i4_yd_index, UWORD8 *pu1_refarray, |
907 | | WORD32 i4_refarray_wd) |
908 | 0 | { |
909 | 0 | WORD32 i4_diff_hor_ver, i4_sgn_xy; |
910 | 0 | WORD32 i4_xc, i4_yc; |
911 | 0 | WORD32 i4_samp1, i4_samp2, i4_samp3; |
912 | 0 | WORD32 i4_result; |
913 | 0 | UWORD8 *pu1_tmp; |
914 | |
|
915 | 0 | i4_diff_hor_ver = ABS(i4_xd_index) - ABS(i4_yd_index); |
916 | 0 | i4_sgn_xy = SIGN(i4_xd_index * i4_yd_index); |
917 | |
|
918 | 0 | if(i4_diff_hor_ver > 0) |
919 | 0 | { |
920 | 0 | i4_xc = i4_x - (i4_sgn_xy * i4_yd_index); |
921 | 0 | i4_yc = i4_y - i4_yd_index; |
922 | |
|
923 | 0 | pu1_tmp = pu1_refarray + (i4_yc * i4_refarray_wd); |
924 | |
|
925 | 0 | i4_samp1 = pu1_tmp[i4_xc - 1]; |
926 | 0 | i4_samp2 = pu1_tmp[i4_xc]; |
927 | 0 | i4_samp3 = pu1_tmp[i4_xc + 1]; |
928 | 0 | } |
929 | 0 | else if(i4_diff_hor_ver < 0) |
930 | 0 | { |
931 | 0 | i4_xc = i4_x - i4_xd_index; |
932 | 0 | i4_yc = i4_y - (i4_sgn_xy * i4_xd_index); |
933 | |
|
934 | 0 | pu1_tmp = pu1_refarray + ((i4_yc - 1) * i4_refarray_wd); |
935 | |
|
936 | 0 | i4_samp1 = pu1_tmp[i4_xc]; |
937 | 0 | pu1_tmp += i4_refarray_wd; |
938 | 0 | i4_samp2 = pu1_tmp[i4_xc]; |
939 | 0 | pu1_tmp += i4_refarray_wd; |
940 | 0 | i4_samp3 = pu1_tmp[i4_xc]; |
941 | 0 | } |
942 | 0 | else |
943 | 0 | { |
944 | 0 | WORD32 i4_ref_xd, i4_ref_yd; |
945 | |
|
946 | 0 | i4_ref_xd = i4_x - i4_xd_index; |
947 | 0 | i4_ref_yd = i4_y - i4_yd_index; |
948 | |
|
949 | 0 | i4_xc = i4_ref_xd + SIGN(i4_xd_index); |
950 | 0 | i4_yc = i4_ref_yd + SIGN(i4_yd_index); |
951 | |
|
952 | 0 | pu1_tmp = pu1_refarray + (i4_ref_yd * i4_refarray_wd); |
953 | |
|
954 | 0 | i4_samp1 = pu1_tmp[i4_xc]; |
955 | 0 | i4_samp2 = pu1_tmp[i4_ref_xd]; |
956 | 0 | pu1_tmp = pu1_refarray + (i4_yc * i4_refarray_wd); |
957 | 0 | i4_samp3 = pu1_tmp[i4_ref_xd]; |
958 | 0 | } |
959 | |
|
960 | 0 | i4_result = (i4_samp1 + (i4_samp2 << 1) + i4_samp3 + 2) >> 2; |
961 | |
|
962 | 0 | pu1_tmp = pu1_refarray + (i4_y * i4_refarray_wd); |
963 | | /* Store the filled sample */ |
964 | 0 | pu1_tmp[i4_x] = i4_result; |
965 | |
|
966 | 0 | return i4_result; |
967 | 0 | } |
968 | | |
969 | | /*****************************************************************************/ |
970 | | /* */ |
971 | | /* Function Name : isvc_corner_samp_dyadic */ |
972 | | /* */ |
973 | | /* Description : This function fills the corner sample in the reference */ |
974 | | /* array with diagonally constructed samples */ |
975 | | /* Inputs : i4_x :current position in reference array X to be filled */ |
976 | | /* i4_y :current position in reference array Y to be filled */ |
977 | | /* i4_xd_index : diagonal index in horizontal direction */ |
978 | | /* i4_yd_index : diagonal index in vertical direction */ |
979 | | /* pu1_refarray_y : pointer to luma reference array */ |
980 | | /* pu1_refarray_cb : pointer to Cb reference array */ |
981 | | /* pu1_refarray_cr : pointer to Cr reference array */ |
982 | | /* Globals : none */ |
983 | | /* Processing : Fills the sample which is unavailable with filtered */ |
984 | | /* diagonal samples */ |
985 | | /* Outputs : pixel filled */ |
986 | | /* Returns : none */ |
987 | | /* */ |
988 | | /* Issues : none */ |
989 | | /* */ |
990 | | /* Revision History: */ |
991 | | /* */ |
992 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
993 | | /* 03 12 2010 Nithya creation */ |
994 | | /* */ |
995 | | /*****************************************************************************/ |
996 | | static void isvc_corner_samp_dyadic(WORD32 i4_x, WORD32 i4_y, WORD32 i4_xD, WORD32 i4_yD, |
997 | | UWORD8 *pu1_refarray_y, UWORD8 *pu1_refarray_cb, |
998 | | UWORD8 *pu1_refarray_cr) |
999 | 0 | { |
1000 | 0 | WORD32 i4_ref_xD, i4_ref_yD; |
1001 | 0 | WORD32 i4_c_ref_xD, i4_c_ref_yD; |
1002 | 0 | WORD32 i4_xc, i4_yc; |
1003 | 0 | WORD32 i4_c_xc, i4_c_yc; |
1004 | 0 | WORD32 i4_samp1, i4_samp2; |
1005 | 0 | UWORD8 *pu1_tmp_src, *pu1_tmp_dst; |
1006 | |
|
1007 | 0 | i4_ref_xD = i4_x - i4_xD; |
1008 | 0 | i4_ref_yD = i4_y - i4_yD; |
1009 | |
|
1010 | 0 | i4_xc = i4_ref_xD + SIGN(i4_xD); |
1011 | 0 | i4_yc = i4_ref_yD + SIGN(i4_yD); |
1012 | | |
1013 | | /* Luma */ |
1014 | 0 | pu1_tmp_src = pu1_refarray_y + (i4_yc * DYADIC_REF_W_Y); |
1015 | 0 | i4_samp1 = pu1_tmp_src[i4_ref_xD]; |
1016 | 0 | pu1_tmp_src = pu1_refarray_y + (i4_ref_yD * DYADIC_REF_W_Y); |
1017 | 0 | i4_samp2 = pu1_tmp_src[i4_xc]; |
1018 | 0 | pu1_tmp_dst = pu1_tmp_src; |
1019 | |
|
1020 | 0 | pu1_tmp_dst[i4_ref_xD] = (i4_samp1 + i4_samp2 + 1) >> 1; |
1021 | | |
1022 | | /* Chroma */ |
1023 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1024 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1025 | |
|
1026 | 0 | i4_c_xc = i4_c_ref_xD + SIGN(i4_xD); |
1027 | 0 | i4_c_yc = i4_c_ref_yD + SIGN(i4_yD); |
1028 | | |
1029 | | /* Cb */ |
1030 | 0 | pu1_tmp_src = pu1_refarray_cb + (i4_c_yc * DYADIC_REF_W_C); |
1031 | 0 | i4_samp1 = pu1_tmp_src[i4_c_ref_xD]; |
1032 | 0 | pu1_tmp_src = pu1_refarray_cb + (i4_c_ref_yD * DYADIC_REF_W_C); |
1033 | 0 | i4_samp2 = pu1_tmp_src[i4_c_xc]; |
1034 | 0 | pu1_tmp_dst = pu1_tmp_src; |
1035 | |
|
1036 | 0 | pu1_tmp_dst[i4_c_ref_xD] = (i4_samp1 + i4_samp2 + 1) >> 1; |
1037 | | |
1038 | | /* Cr */ |
1039 | 0 | pu1_tmp_src = pu1_refarray_cr + (i4_c_yc * DYADIC_REF_W_C); |
1040 | 0 | i4_samp1 = pu1_tmp_src[i4_c_ref_xD]; |
1041 | 0 | pu1_tmp_src = pu1_refarray_cr + (i4_c_ref_yD * DYADIC_REF_W_C); |
1042 | 0 | i4_samp2 = pu1_tmp_src[i4_c_xc]; |
1043 | 0 | pu1_tmp_dst = pu1_tmp_src; |
1044 | |
|
1045 | 0 | pu1_tmp_dst[i4_c_ref_xD] = (i4_samp1 + i4_samp2 + 1) >> 1; |
1046 | 0 | } |
1047 | | |
1048 | | /*****************************************************************************/ |
1049 | | /* */ |
1050 | | /* Function Name : isvc_reflayer_construction_dyadic */ |
1051 | | /* */ |
1052 | | /* Description : This function constructs the reference array buffer */ |
1053 | | /* for dyadic cases used for intra resampling of a */ |
1054 | | /* component in an MB */ |
1055 | | /* */ |
1056 | | /* Inputs : pv_intra_samp_ctxt : intra sampling context */ |
1057 | | /* ps_ref_mb_mode_map : ref layer mb mode buffer desc */ |
1058 | | /* pu1_inp_luma : luma input (reference layer data) */ |
1059 | | /* pu1_inp_chroma : chroma input (reference layer data) */ |
1060 | | /* i4_inp_luma_stride : luma input buffer stride */ |
1061 | | /* i4_inp_chroma_stride : chroma input buffer stride */ |
1062 | | /* i4_top : indicates whether the core 8x8 reference block */ |
1063 | | /* is one of 0 and 1 or one of 2 and 3 */ |
1064 | | /* i4_left : indicates whether the core 8x8 reference block */ |
1065 | | /* is one of 0 and 2 or one of 1 and 3 */ |
1066 | | /* ps_ref_mb_coord : coordinates of the reference MB */ |
1067 | | /* Globals : none */ |
1068 | | /* Processing : it fills the reference layer data if they are falling in */ |
1069 | | /* INTRA MB region. If all the pixels are not filled it */ |
1070 | | /* calls the border extension algorithm to fill them */ |
1071 | | /* Outputs : none */ |
1072 | | /* Returns : none */ |
1073 | | /* */ |
1074 | | /* Issues : none */ |
1075 | | /* */ |
1076 | | /* Revision History: */ |
1077 | | /* */ |
1078 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1079 | | /* 02 12 2010 Nithya creation */ |
1080 | | /* */ |
1081 | | /*****************************************************************************/ |
1082 | | static void isvc_reflayer_construction_dyadic(void *pv_intra_samp_ctxt, |
1083 | | mem_element_t *ps_ref_mb_mode_map, |
1084 | | UWORD8 *pu1_inp_luma, UWORD8 *pu1_inp_chroma, |
1085 | | WORD32 i4_inp_luma_stride, |
1086 | | WORD32 i4_inp_chroma_stride, WORD32 i4_top, |
1087 | | WORD32 i4_left, UWORD16 u2_mb_x, UWORD16 u2_mb_y) |
1088 | 5.55M | { |
1089 | 5.55M | enum |
1090 | 5.55M | { |
1091 | 5.55M | TOPLEFT_MASK = 1, |
1092 | 5.55M | LEFT_MASK = 2, |
1093 | 5.55M | TOP_MASK = 4, |
1094 | 5.55M | TOPRIGHT_MASK = 8, |
1095 | 5.55M | BOTTOMLEFT_MASK = 16 |
1096 | 5.55M | }; |
1097 | | |
1098 | 5.55M | WORD32 i4_x, i4_y; |
1099 | 5.55M | WORD32 i4_x0, i4_y0; |
1100 | 5.55M | WORD32 i4_xc0, i4_yc0; |
1101 | 5.55M | WORD32 i4_ref_xD, i4_ref_yD; |
1102 | 5.55M | WORD32 i4_c_ref_xD, i4_c_ref_yD; |
1103 | | |
1104 | 5.55M | intra_sampling_ctxt_t *ps_ctxt; |
1105 | 5.55M | intra_samp_lyr_ctxt *ps_lyr_ctxt; |
1106 | 5.55M | WORD8 *pi1_ref_mb_modes; |
1107 | 5.55M | WORD32 i4_ref_mode_stride; |
1108 | 5.55M | WORD32 i4_element_size; |
1109 | 5.55M | WORD32 i4_mbaddr_y; |
1110 | 5.55M | WORD32 i4_mbaddr_x; |
1111 | | |
1112 | 5.55M | WORD32 i4_refarray_wd_luma, i4_refarray_wd_chroma; |
1113 | 5.55M | WORD32 i4_refarray_ht_luma, i4_refarray_ht_chroma; |
1114 | 5.55M | WORD32 i4_avlblty; |
1115 | 5.55M | WORD8 i1_cons_intr_samp_flag; |
1116 | 5.55M | WORD8 i1_slice_id; |
1117 | 5.55M | WORD8 i1_corner_samp_avlbl_flag; |
1118 | 5.55M | UWORD8 u1_ny_avlblty; |
1119 | | |
1120 | 5.55M | UWORD8 *pu1_refarray_luma; |
1121 | 5.55M | UWORD8 *pu1_refarray_cb, *pu1_refarray_cr; |
1122 | | |
1123 | 5.55M | ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt; |
1124 | 5.55M | ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id]; |
1125 | 5.55M | pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer; |
1126 | 5.55M | i4_ref_mode_stride = ps_ref_mb_mode_map->i4_num_element_stride; |
1127 | 5.55M | i4_element_size = ps_ref_mb_mode_map->i4_element_size; |
1128 | | |
1129 | 5.55M | i1_cons_intr_samp_flag = ps_lyr_ctxt->i1_constrained_intra_rsmpl_flag; |
1130 | | |
1131 | 5.55M | ASSERT(NULL != pi1_ref_mb_modes); |
1132 | | |
1133 | 5.55M | pu1_refarray_luma = ps_ctxt->pu1_refarray_buffer; |
1134 | 5.55M | pu1_refarray_cb = ps_ctxt->pu1_refarray_cb; |
1135 | 5.55M | pu1_refarray_cr = ps_ctxt->pu1_refarray_cr; |
1136 | | |
1137 | 5.55M | i4_mbaddr_x = u2_mb_x; |
1138 | 5.55M | i4_mbaddr_y = u2_mb_y; |
1139 | | |
1140 | 5.55M | i4_refarray_wd_luma = 20; |
1141 | 5.55M | i4_refarray_ht_luma = 20; |
1142 | | |
1143 | 5.55M | i4_refarray_wd_chroma = i4_refarray_wd_luma >> 1; |
1144 | 5.55M | i4_refarray_ht_chroma = i4_refarray_ht_luma >> 1; |
1145 | | |
1146 | 5.55M | if(1 == i1_cons_intr_samp_flag) |
1147 | 0 | { |
1148 | 0 | WORD8 *pi1_ref_mb_mode_tmp; |
1149 | 0 | WORD8 i1_mb_mode; |
1150 | |
|
1151 | 0 | pi1_ref_mb_mode_tmp = pi1_ref_mb_modes; |
1152 | 0 | pi1_ref_mb_mode_tmp += (i4_mbaddr_y * i4_ref_mode_stride * i4_element_size); |
1153 | 0 | pi1_ref_mb_mode_tmp += (i4_mbaddr_x * i4_element_size); |
1154 | 0 | i1_mb_mode = *pi1_ref_mb_mode_tmp; |
1155 | 0 | i1_mb_mode = (i1_mb_mode < 0) ? i1_mb_mode : SVC_EXTRACT_MB_MODE(*pi1_ref_mb_mode_tmp); |
1156 | | |
1157 | | /* The reference layer MB should be intra */ |
1158 | 0 | ASSERT(i1_mb_mode >= 0); |
1159 | | |
1160 | 0 | i1_slice_id = i1_mb_mode; |
1161 | 0 | } |
1162 | 5.55M | else |
1163 | 5.55M | { |
1164 | 5.55M | i1_slice_id = -1; |
1165 | 5.55M | } |
1166 | | |
1167 | 5.55M | { |
1168 | 5.55M | UWORD8 *pu1_src, *pu1_dst; |
1169 | 5.55M | WORD32 i4_src_stride, i4_dst_stride; |
1170 | | |
1171 | | /* Copy luma */ |
1172 | 5.55M | i4_src_stride = i4_inp_luma_stride; |
1173 | 5.55M | i4_dst_stride = DYADIC_REF_W_Y; |
1174 | 5.55M | pu1_src = pu1_inp_luma; |
1175 | 5.55M | pu1_dst = pu1_refarray_luma; |
1176 | | |
1177 | 5.55M | isvc_copy_data(pu1_src, i4_src_stride, pu1_dst, i4_dst_stride, i4_refarray_wd_luma, |
1178 | 5.55M | i4_refarray_ht_luma); |
1179 | | |
1180 | 5.55M | i4_src_stride = i4_inp_chroma_stride; |
1181 | 5.55M | i4_dst_stride = DYADIC_REF_W_C; |
1182 | 5.55M | pu1_src = pu1_inp_chroma; |
1183 | 5.55M | isvc_copy_data_semiplanr(pu1_src, i4_src_stride, pu1_refarray_cb, pu1_refarray_cr, |
1184 | 5.55M | i4_dst_stride, i4_refarray_wd_chroma, i4_refarray_ht_chroma); |
1185 | 5.55M | } |
1186 | | |
1187 | 5.55M | { |
1188 | | /* mb_x + left, mb_y + top */ |
1189 | 5.55M | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1190 | 5.55M | i4_mbaddr_x + i4_left, i4_mbaddr_y + i4_top, &i4_avlblty, |
1191 | 5.55M | i1_slice_id, i1_cons_intr_samp_flag); |
1192 | 5.55M | u1_ny_avlblty = i4_avlblty; |
1193 | | |
1194 | | /* mb_x + left, mb_y */ |
1195 | 5.55M | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1196 | 5.55M | i4_mbaddr_x + i4_left, i4_mbaddr_y, &i4_avlblty, |
1197 | 5.55M | i1_slice_id, i1_cons_intr_samp_flag); |
1198 | 5.55M | u1_ny_avlblty += (i4_avlblty << 1); |
1199 | | |
1200 | | /* mb_x, mb_y + top */ |
1201 | 5.55M | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1202 | 5.55M | i4_mbaddr_x, i4_mbaddr_y + i4_top, &i4_avlblty, |
1203 | 5.55M | i1_slice_id, i1_cons_intr_samp_flag); |
1204 | 5.55M | u1_ny_avlblty += (i4_avlblty << 2); |
1205 | | |
1206 | | /* mb_x - left, mb_y + top */ |
1207 | 5.55M | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1208 | 5.55M | i4_mbaddr_x - i4_left, i4_mbaddr_y + i4_top, &i4_avlblty, |
1209 | 5.55M | i1_slice_id, i1_cons_intr_samp_flag); |
1210 | 5.55M | u1_ny_avlblty += (i4_avlblty << 3); |
1211 | | |
1212 | | /* mb_x + left, mb_y - top */ |
1213 | 5.55M | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1214 | 5.55M | i4_mbaddr_x + i4_left, i4_mbaddr_y - i4_top, &i4_avlblty, |
1215 | 5.55M | i1_slice_id, i1_cons_intr_samp_flag); |
1216 | 5.55M | u1_ny_avlblty += (i4_avlblty << 4); |
1217 | 5.55M | } |
1218 | | |
1219 | 5.55M | if((TOP_MASK | TOPLEFT_MASK | LEFT_MASK) == u1_ny_avlblty) |
1220 | 0 | { |
1221 | 0 | return; |
1222 | 0 | } |
1223 | | |
1224 | 5.55M | if(!(u1_ny_avlblty & (TOP_MASK | TOPLEFT_MASK | LEFT_MASK))) |
1225 | 0 | { |
1226 | 0 | UWORD8 *pu1_tmp_src, *pu1_tmp_dst1, *pu1_tmp_dst2; |
1227 | 0 | UWORD8 *pu1_tmp_src1, *pu1_tmp_src2; |
1228 | | |
1229 | | /* Set the 4 corner samples to (x-xD,y-yD) */ |
1230 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1231 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1232 | |
|
1233 | 0 | i4_ref_xD = i4_x0 - i4_left - (i4_left >> 1); |
1234 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1235 | |
|
1236 | 0 | pu1_tmp_src = pu1_refarray_luma + (i4_ref_yD * DYADIC_REF_W_Y); |
1237 | 0 | pu1_tmp_dst1 = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1238 | 0 | pu1_tmp_dst2 = pu1_tmp_dst1 + DYADIC_REF_W_Y; |
1239 | |
|
1240 | 0 | pu1_tmp_dst1[i4_x0] = pu1_tmp_src[i4_ref_xD]; |
1241 | 0 | pu1_tmp_dst1[i4_x0 + 1] = pu1_tmp_src[i4_ref_xD]; |
1242 | 0 | pu1_tmp_dst2[i4_x0] = pu1_tmp_src[i4_ref_xD]; |
1243 | 0 | pu1_tmp_dst2[i4_x0 + 1] = pu1_tmp_src[i4_ref_xD]; |
1244 | | |
1245 | | /* Set the corner sample of Cb and Cr to (x-xD,y-yD) */ |
1246 | 0 | i4_xc0 = i4_x0 >> 1; |
1247 | 0 | i4_yc0 = i4_y0 >> 1; |
1248 | |
|
1249 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1250 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1251 | |
|
1252 | 0 | pu1_tmp_src1 = pu1_refarray_cb + (i4_c_ref_yD * DYADIC_REF_W_C); |
1253 | 0 | pu1_tmp_dst1 = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1254 | 0 | pu1_tmp_dst1[i4_xc0] = pu1_tmp_src1[i4_c_ref_xD]; |
1255 | 0 | pu1_tmp_src2 = pu1_refarray_cr + (i4_c_ref_yD * DYADIC_REF_W_C); |
1256 | 0 | pu1_tmp_dst2 = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1257 | 0 | pu1_tmp_dst2[i4_xc0] = pu1_tmp_src2[i4_c_ref_xD]; |
1258 | 0 | } |
1259 | | |
1260 | 5.55M | if(!(u1_ny_avlblty & (TOP_MASK | TOPLEFT_MASK))) |
1261 | 0 | { |
1262 | 0 | UWORD8 *pu1_tmp_src, *pu1_tmp_dst1, *pu1_tmp_dst2; |
1263 | 0 | UWORD8 *pu1_tmp_src1, *pu1_tmp_src2; |
1264 | | |
1265 | | /* Copy (x0,ref_yD), (x0+1,ref_yD), ..., (x0+7,ref_yD) to */ |
1266 | | /* (x0,y0), (x0+1,y0), ..., (x0+7,y0) and */ |
1267 | | /* (x0,y0+1), (x0+1,y0+1), ..., (x0+7,y0+1) */ |
1268 | 0 | i4_x0 = 2; |
1269 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1270 | 0 | if(i4_left > 0) |
1271 | 0 | { |
1272 | 0 | i4_x0 += 8; |
1273 | 0 | } |
1274 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1275 | |
|
1276 | 0 | pu1_tmp_src = pu1_refarray_luma + (i4_ref_yD * DYADIC_REF_W_Y); |
1277 | 0 | pu1_tmp_dst1 = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1278 | 0 | pu1_tmp_dst2 = pu1_tmp_dst1 + DYADIC_REF_W_Y; |
1279 | |
|
1280 | 0 | for(i4_x = i4_x0; i4_x < i4_x0 + 8; i4_x++) |
1281 | 0 | { |
1282 | 0 | pu1_tmp_dst1[i4_x] = pu1_tmp_src[i4_x]; |
1283 | 0 | pu1_tmp_dst2[i4_x] = pu1_tmp_src[i4_x]; |
1284 | 0 | } |
1285 | | |
1286 | | /* Cb and Cr copy */ |
1287 | 0 | i4_xc0 = i4_x0 >> 1; |
1288 | 0 | i4_yc0 = i4_y0 >> 1; |
1289 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1290 | |
|
1291 | 0 | pu1_tmp_src1 = pu1_refarray_cb + (i4_c_ref_yD * DYADIC_REF_W_C); |
1292 | 0 | pu1_tmp_dst1 = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1293 | 0 | pu1_tmp_src2 = pu1_refarray_cr + (i4_c_ref_yD * DYADIC_REF_W_C); |
1294 | 0 | pu1_tmp_dst2 = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1295 | |
|
1296 | 0 | for(i4_x = i4_xc0; i4_x < i4_xc0 + 4; i4_x++) |
1297 | 0 | { |
1298 | 0 | pu1_tmp_dst1[i4_x] = pu1_tmp_src1[i4_x]; |
1299 | 0 | pu1_tmp_dst2[i4_x] = pu1_tmp_src2[i4_x]; |
1300 | 0 | } |
1301 | 0 | } |
1302 | | |
1303 | 5.55M | if(!(u1_ny_avlblty & (TOPLEFT_MASK | LEFT_MASK))) |
1304 | 0 | { |
1305 | 0 | UWORD8 *pu1_tmp_src, *pu1_tmp_dst1, *pu1_tmp_dst2; |
1306 | 0 | UWORD8 *pu1_tmp_src1, *pu1_tmp_src2; |
1307 | | |
1308 | | /* Copy (ref_xD,y0) to (x0,y0) and (x0+1,y0); */ |
1309 | | /* copy (ref_xD,y0+1) to (x0,y0+1) and (x0+1,y0+1); ... ;*/ |
1310 | | /* copy (ref_xD,y0+7) to (x0,y0+7) and (x0+1,y0+7) */ |
1311 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1312 | 0 | i4_y0 = 2; |
1313 | 0 | if(i4_top > 0) |
1314 | 0 | { |
1315 | 0 | i4_y0 += 8; |
1316 | 0 | } |
1317 | 0 | i4_ref_xD = i4_x0 - i4_left - (i4_left >> 1); |
1318 | |
|
1319 | 0 | pu1_tmp_src = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1320 | 0 | pu1_tmp_dst1 = pu1_tmp_src; |
1321 | |
|
1322 | 0 | for(i4_y = i4_y0; i4_y < i4_y0 + 8; i4_y++) |
1323 | 0 | { |
1324 | 0 | pu1_tmp_dst1[i4_x0] = pu1_tmp_src[i4_ref_xD]; |
1325 | 0 | pu1_tmp_dst1[i4_x0 + 1] = pu1_tmp_src[i4_ref_xD]; |
1326 | 0 | pu1_tmp_src += DYADIC_REF_W_Y; |
1327 | 0 | pu1_tmp_dst1 += DYADIC_REF_W_Y; |
1328 | 0 | } |
1329 | | |
1330 | | /* Cb and Cr copy */ |
1331 | 0 | i4_xc0 = i4_x0 >> 1; |
1332 | 0 | i4_yc0 = i4_y0 >> 1; |
1333 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1334 | |
|
1335 | 0 | pu1_tmp_src1 = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1336 | 0 | pu1_tmp_dst1 = pu1_tmp_src1; |
1337 | 0 | pu1_tmp_src2 = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1338 | 0 | pu1_tmp_dst2 = pu1_tmp_src2; |
1339 | |
|
1340 | 0 | for(i4_y = i4_yc0; i4_y < i4_yc0 + 4; i4_y++) |
1341 | 0 | { |
1342 | 0 | pu1_tmp_dst1[i4_xc0] = pu1_tmp_src1[i4_c_ref_xD]; |
1343 | 0 | pu1_tmp_dst2[i4_xc0] = pu1_tmp_src2[i4_c_ref_xD]; |
1344 | 0 | pu1_tmp_src1 += DYADIC_REF_W_C; |
1345 | 0 | pu1_tmp_src2 += DYADIC_REF_W_C; |
1346 | 0 | pu1_tmp_dst1 += DYADIC_REF_W_C; |
1347 | 0 | pu1_tmp_dst2 += DYADIC_REF_W_C; |
1348 | 0 | } |
1349 | 0 | } |
1350 | | |
1351 | 5.55M | if(!(u1_ny_avlblty & TOP_MASK)) |
1352 | 0 | { |
1353 | 0 | if(!(u1_ny_avlblty & TOPRIGHT_MASK)) |
1354 | 0 | { |
1355 | 0 | UWORD8 *pu1_tmp_src, *pu1_tmp_dst; |
1356 | |
|
1357 | 0 | i4_x0 = 9 - i4_left; |
1358 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1359 | |
|
1360 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1361 | | |
1362 | | /* Copy (x0,ref_yD) and (x0+1,ref_yD) to (x0,y0) and (x0+1,y0), and */ |
1363 | | /* to (x0,y0+1) and (x0+1,y0+1) */ |
1364 | 0 | pu1_tmp_src = pu1_refarray_luma + (i4_ref_yD * DYADIC_REF_W_Y); |
1365 | 0 | pu1_tmp_dst = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1366 | |
|
1367 | 0 | pu1_tmp_dst[i4_x0] = pu1_tmp_src[i4_x0]; |
1368 | 0 | pu1_tmp_dst[i4_x0 + 1] = pu1_tmp_src[i4_x0 + 1]; |
1369 | |
|
1370 | 0 | pu1_tmp_dst += DYADIC_REF_W_Y; |
1371 | |
|
1372 | 0 | pu1_tmp_dst[i4_x0] = pu1_tmp_src[i4_x0]; |
1373 | 0 | pu1_tmp_dst[i4_x0 + 1] = pu1_tmp_src[i4_x0 + 1]; |
1374 | | |
1375 | | /* Cb copy */ |
1376 | 0 | i4_xc0 = i4_x0 >> 1; |
1377 | 0 | i4_yc0 = i4_y0 >> 1; |
1378 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1379 | |
|
1380 | 0 | pu1_tmp_src = pu1_refarray_cb + (i4_c_ref_yD * DYADIC_REF_W_C); |
1381 | 0 | pu1_tmp_dst = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1382 | |
|
1383 | 0 | pu1_tmp_dst[i4_xc0] = pu1_tmp_src[i4_xc0]; |
1384 | | |
1385 | | /* Cr copy */ |
1386 | 0 | pu1_tmp_src = pu1_refarray_cr + (i4_c_ref_yD * DYADIC_REF_W_C); |
1387 | 0 | pu1_tmp_dst = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1388 | |
|
1389 | 0 | pu1_tmp_dst[i4_xc0] = pu1_tmp_src[i4_xc0]; |
1390 | 0 | } |
1391 | 0 | else |
1392 | 0 | { |
1393 | 0 | WORD32 i4_xD, i4_yD; |
1394 | 0 | WORD32 i4_c_xD, i4_c_yD; |
1395 | |
|
1396 | 0 | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1397 | 0 | i4_mbaddr_x - i4_left, i4_mbaddr_y, &i4_avlblty, |
1398 | 0 | i1_slice_id, i1_cons_intr_samp_flag); |
1399 | 0 | i1_corner_samp_avlbl_flag = i4_avlblty; |
1400 | |
|
1401 | 0 | i4_x0 = 9 - i4_left; |
1402 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1403 | |
|
1404 | 0 | i4_xc0 = i4_x0 >> 1; |
1405 | 0 | i4_yc0 = i4_y0 >> 1; |
1406 | |
|
1407 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1408 | 0 | i4_ref_xD = i4_x0 - (i4_left * 7) - (i4_left >> 1); |
1409 | |
|
1410 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1411 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1412 | |
|
1413 | 0 | i4_xD = i4_x0 - i4_ref_xD; |
1414 | 0 | i4_yD = i4_y0 - i4_ref_yD; |
1415 | |
|
1416 | 0 | i4_c_xD = i4_xc0 - i4_c_ref_xD; |
1417 | 0 | i4_c_yD = i4_yc0 - i4_c_ref_yD; |
1418 | | |
1419 | | /* Fill corner sample if not available */ |
1420 | 0 | if(!i1_corner_samp_avlbl_flag) |
1421 | 0 | { |
1422 | 0 | isvc_corner_samp_dyadic(i4_x0, i4_y0, i4_xD, i4_yD, pu1_refarray_luma, |
1423 | 0 | pu1_refarray_cb, pu1_refarray_cr); |
1424 | 0 | } |
1425 | | |
1426 | | /* Call diagonal construction for luma */ |
1427 | 0 | for(i4_y = i4_y0; i4_y < i4_y0 + 2; i4_y++) |
1428 | 0 | { |
1429 | 0 | for(i4_x = i4_x0; i4_x < i4_x0 + 2; i4_x++) |
1430 | 0 | { |
1431 | 0 | isvc_diagonal_construct_dyadic(i4_x, i4_y, i4_xD, i4_yD, pu1_refarray_luma, |
1432 | 0 | DYADIC_REF_W_Y); |
1433 | 0 | i4_xD++; |
1434 | 0 | } |
1435 | 0 | i4_yD++; |
1436 | 0 | i4_xD -= 2; |
1437 | 0 | } |
1438 | | |
1439 | | /* Call diagonal construction for chroma */ |
1440 | 0 | isvc_diagonal_construct_dyadic(i4_xc0, i4_yc0, i4_c_xD, i4_c_yD, pu1_refarray_cb, |
1441 | 0 | DYADIC_REF_W_C); |
1442 | |
|
1443 | 0 | isvc_diagonal_construct_dyadic(i4_xc0, i4_yc0, i4_c_xD, i4_c_yD, pu1_refarray_cr, |
1444 | 0 | DYADIC_REF_W_C); |
1445 | 0 | } |
1446 | 0 | } |
1447 | | |
1448 | 5.55M | if(!(u1_ny_avlblty & LEFT_MASK)) |
1449 | 0 | { |
1450 | 0 | if(!(u1_ny_avlblty & BOTTOMLEFT_MASK)) |
1451 | 0 | { |
1452 | 0 | UWORD8 *pu1_tmp_src, *pu1_tmp_dst; |
1453 | |
|
1454 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1455 | 0 | i4_y0 = 9 - i4_top; |
1456 | 0 | i4_ref_xD = i4_x0 - i4_left - (i4_left >> 1); |
1457 | | |
1458 | | /* Copy (ref_xD,y0) to (x0,y0), (x0+1,y0), and */ |
1459 | | /* copy (ref_xD,y0+1) to (x0,y0+1), (x0+1,y0+1) */ |
1460 | 0 | pu1_tmp_src = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1461 | 0 | pu1_tmp_dst = pu1_tmp_src; |
1462 | |
|
1463 | 0 | pu1_tmp_dst[i4_x0] = pu1_tmp_src[i4_ref_xD]; |
1464 | 0 | pu1_tmp_dst[i4_x0 + 1] = pu1_tmp_src[i4_ref_xD]; |
1465 | |
|
1466 | 0 | pu1_tmp_src += DYADIC_REF_W_Y; |
1467 | 0 | pu1_tmp_dst += DYADIC_REF_W_Y; |
1468 | |
|
1469 | 0 | pu1_tmp_dst[i4_x0] = pu1_tmp_src[i4_ref_xD]; |
1470 | 0 | pu1_tmp_dst[i4_x0 + 1] = pu1_tmp_src[i4_ref_xD]; |
1471 | | |
1472 | | /* Cb copy */ |
1473 | 0 | i4_xc0 = i4_x0 >> 1; |
1474 | 0 | i4_yc0 = i4_y0 >> 1; |
1475 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1476 | |
|
1477 | 0 | pu1_tmp_src = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1478 | 0 | pu1_tmp_dst = pu1_tmp_src; |
1479 | |
|
1480 | 0 | pu1_tmp_dst[i4_xc0] = pu1_tmp_src[i4_c_ref_xD]; |
1481 | | |
1482 | | /* Cr copy */ |
1483 | 0 | pu1_tmp_src = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1484 | 0 | pu1_tmp_dst = pu1_tmp_src; |
1485 | |
|
1486 | 0 | pu1_tmp_dst[i4_xc0] = pu1_tmp_src[i4_c_ref_xD]; |
1487 | 0 | } |
1488 | 0 | else |
1489 | 0 | { |
1490 | 0 | WORD32 i4_xD, i4_yD; |
1491 | 0 | WORD32 i4_c_xD, i4_c_yD; |
1492 | |
|
1493 | 0 | isvc_get_ref_layer_avlblty_dyadic(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size, |
1494 | 0 | i4_mbaddr_x, i4_mbaddr_y - i4_top, &i4_avlblty, |
1495 | 0 | i1_slice_id, i1_cons_intr_samp_flag); |
1496 | 0 | i1_corner_samp_avlbl_flag = i4_avlblty; |
1497 | |
|
1498 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1499 | 0 | i4_y0 = 9 - i4_top; |
1500 | |
|
1501 | 0 | i4_xc0 = i4_x0 >> 1; |
1502 | 0 | i4_yc0 = i4_y0 >> 1; |
1503 | |
|
1504 | 0 | i4_ref_xD = i4_x0 - i4_left - (i4_left >> 1); |
1505 | 0 | i4_ref_yD = i4_y0 - (i4_top * 7) - (i4_top >> 1); |
1506 | |
|
1507 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1508 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1509 | |
|
1510 | 0 | i4_xD = i4_x0 - i4_ref_xD; |
1511 | 0 | i4_yD = i4_y0 - i4_ref_yD; |
1512 | |
|
1513 | 0 | i4_c_xD = i4_xc0 - i4_c_ref_xD; |
1514 | 0 | i4_c_yD = i4_yc0 - i4_c_ref_yD; |
1515 | |
|
1516 | 0 | if(!i1_corner_samp_avlbl_flag) |
1517 | 0 | { |
1518 | 0 | isvc_corner_samp_dyadic(i4_x0, i4_y0, i4_xD, i4_yD, pu1_refarray_luma, |
1519 | 0 | pu1_refarray_cb, pu1_refarray_cr); |
1520 | 0 | } |
1521 | | |
1522 | | /* Call diagonal consrtuction for luma */ |
1523 | 0 | for(i4_y = i4_y0; i4_y < i4_y0 + 2; i4_y++) |
1524 | 0 | { |
1525 | 0 | for(i4_x = i4_x0; i4_x < i4_x0 + 2; i4_x++) |
1526 | 0 | { |
1527 | 0 | isvc_diagonal_construct_dyadic(i4_x, i4_y, i4_xD, i4_yD, pu1_refarray_luma, |
1528 | 0 | DYADIC_REF_W_Y); |
1529 | 0 | i4_xD++; |
1530 | 0 | } |
1531 | 0 | i4_yD++; |
1532 | 0 | i4_xD -= 2; |
1533 | 0 | } |
1534 | | |
1535 | | /* Call diagonal construction for chroma */ |
1536 | 0 | isvc_diagonal_construct_dyadic(i4_xc0, i4_yc0, i4_c_xD, i4_c_yD, pu1_refarray_cb, |
1537 | 0 | DYADIC_REF_W_C); |
1538 | |
|
1539 | 0 | isvc_diagonal_construct_dyadic(i4_xc0, i4_yc0, i4_c_xD, i4_c_yD, pu1_refarray_cr, |
1540 | 0 | DYADIC_REF_W_C); |
1541 | 0 | } |
1542 | 0 | } |
1543 | | |
1544 | 5.55M | if(u1_ny_avlblty & TOPLEFT_MASK) |
1545 | 5.59M | { |
1546 | 5.59M | if(!(u1_ny_avlblty & LEFT_MASK)) |
1547 | 0 | { |
1548 | 0 | WORD32 i4_xD, i4_yD; |
1549 | 0 | WORD32 i4_c_xD, i4_c_yD; |
1550 | 0 | UWORD8 *pu1_tmp_dst; |
1551 | 0 | UWORD8 u1_filled_samp; |
1552 | |
|
1553 | 0 | i1_corner_samp_avlbl_flag = (u1_ny_avlblty & 4) >> 2; |
1554 | |
|
1555 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1556 | 0 | i4_y0 = 2; |
1557 | 0 | i4_ref_yD = 1; |
1558 | 0 | if(i4_top > 0) |
1559 | 0 | { |
1560 | 0 | i4_y0 += 8; |
1561 | 0 | i4_ref_yD = 18; |
1562 | 0 | } |
1563 | |
|
1564 | 0 | i4_ref_xD = i4_x0 - (i4_left) - (i4_left >> 1); |
1565 | |
|
1566 | 0 | i4_xD = i4_x0 - i4_ref_xD; |
1567 | 0 | i4_yD = i4_y0 - i4_ref_yD; |
1568 | |
|
1569 | 0 | i4_xc0 = i4_x0 >> 1; |
1570 | 0 | i4_yc0 = i4_y0 >> 1; |
1571 | |
|
1572 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1573 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1574 | |
|
1575 | 0 | i4_c_xD = i4_xc0 - i4_c_ref_xD; |
1576 | 0 | i4_c_yD = i4_yc0 - i4_c_ref_yD; |
1577 | | |
1578 | | /* Fill corner sample if unavailable */ |
1579 | 0 | if(!i1_corner_samp_avlbl_flag) |
1580 | 0 | { |
1581 | 0 | isvc_corner_samp_dyadic(i4_x0, i4_y0, i4_xD, i4_yD, pu1_refarray_luma, |
1582 | 0 | pu1_refarray_cb, pu1_refarray_cr); |
1583 | 0 | } |
1584 | | |
1585 | | /* Call the diagonal construction for the 8 rows */ |
1586 | 0 | if(i4_top == i4_left) |
1587 | 0 | { |
1588 | | /* if top * left = 1 */ |
1589 | | /* (x0,y0) */ |
1590 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x0, i4_y0, i4_xD, i4_yD, |
1591 | 0 | pu1_refarray_luma, DYADIC_REF_W_Y); |
1592 | |
|
1593 | 0 | pu1_tmp_dst = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1594 | | |
1595 | | /* (x0,y0+1), ..., (x0,y0+7) and */ |
1596 | | /* (x0+1,y0), ..., (x0+1,y0+6) */ |
1597 | 0 | for(i4_y = i4_y0 + 1; i4_y < i4_y0 + 8; i4_y++) |
1598 | 0 | { |
1599 | 0 | i4_yD++; |
1600 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic( |
1601 | 0 | i4_x0, i4_y, i4_xD, i4_yD, pu1_refarray_luma, DYADIC_REF_W_Y); |
1602 | 0 | pu1_tmp_dst[i4_x0 + 1] = u1_filled_samp; |
1603 | 0 | pu1_tmp_dst += DYADIC_REF_W_Y; |
1604 | 0 | } |
1605 | | |
1606 | | /* (x0+1,y0+7) */ |
1607 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic( |
1608 | 0 | i4_x0 + 1, i4_y0 + 7, i4_xD + 1, i4_yD, pu1_refarray_luma, DYADIC_REF_W_Y); |
1609 | 0 | } |
1610 | 0 | else |
1611 | 0 | { |
1612 | | /* top * left = -1 */ |
1613 | | /* (x0+1,y0) */ |
1614 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x0 + 1, i4_y0, i4_xD + 1, i4_yD, |
1615 | 0 | pu1_refarray_luma, DYADIC_REF_W_Y); |
1616 | |
|
1617 | 0 | pu1_tmp_dst = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1618 | | |
1619 | | /* (x0,y0), ..., (x0,y0+6) and */ |
1620 | | /* (x0+1,y0+1), ..., (x0+1,y0+7) */ |
1621 | 0 | for(i4_y = i4_y0; i4_y < i4_y0 + 7; i4_y++) |
1622 | 0 | { |
1623 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic( |
1624 | 0 | i4_x0, i4_y, i4_xD, i4_yD, pu1_refarray_luma, DYADIC_REF_W_Y); |
1625 | |
|
1626 | 0 | pu1_tmp_dst += DYADIC_REF_W_Y; |
1627 | 0 | pu1_tmp_dst[i4_x0 + 1] = u1_filled_samp; |
1628 | 0 | i4_yD++; |
1629 | 0 | } |
1630 | | |
1631 | | /* (x0,y0+7) */ |
1632 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x0, i4_y0 + 7, i4_xD, i4_yD, |
1633 | 0 | pu1_refarray_luma, DYADIC_REF_W_Y); |
1634 | 0 | } |
1635 | | |
1636 | | /* For Cb and Cr */ |
1637 | 0 | for(i4_y = i4_yc0; i4_y < i4_yc0 + 4; i4_y++) |
1638 | 0 | { |
1639 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_xc0, i4_y, i4_c_xD, i4_c_yD, |
1640 | 0 | pu1_refarray_cb, DYADIC_REF_W_C); |
1641 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_xc0, i4_y, i4_c_xD, i4_c_yD, |
1642 | 0 | pu1_refarray_cr, DYADIC_REF_W_C); |
1643 | 0 | i4_c_yD++; |
1644 | 0 | } |
1645 | 0 | } |
1646 | | |
1647 | 5.59M | if(!(u1_ny_avlblty & TOP_MASK)) |
1648 | 0 | { |
1649 | 0 | WORD32 i4_xD, i4_yD; |
1650 | 0 | WORD32 i4_c_xD, i4_c_yD; |
1651 | 0 | UWORD8 *pu1_tmp_dst; |
1652 | 0 | UWORD8 u1_filled_samp; |
1653 | |
|
1654 | 0 | i1_corner_samp_avlbl_flag = (u1_ny_avlblty & 2) >> 1; |
1655 | |
|
1656 | 0 | i4_y0 = 9 + (i4_top << 3) + (i4_top); |
1657 | 0 | i4_x0 = 2; |
1658 | 0 | i4_ref_xD = 1; |
1659 | 0 | if(i4_left > 0) |
1660 | 0 | { |
1661 | 0 | i4_x0 += 8; |
1662 | 0 | i4_ref_xD = 18; |
1663 | 0 | } |
1664 | |
|
1665 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1666 | |
|
1667 | 0 | i4_xD = i4_x0 - i4_ref_xD; |
1668 | 0 | i4_yD = i4_y0 - i4_ref_yD; |
1669 | |
|
1670 | 0 | i4_xc0 = i4_x0 >> 1; |
1671 | 0 | i4_yc0 = i4_y0 >> 1; |
1672 | |
|
1673 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1674 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1675 | |
|
1676 | 0 | i4_c_xD = i4_xc0 - i4_c_ref_xD; |
1677 | 0 | i4_c_yD = i4_yc0 - i4_c_ref_yD; |
1678 | |
|
1679 | 0 | if(!i1_corner_samp_avlbl_flag) |
1680 | 0 | { |
1681 | 0 | isvc_corner_samp_dyadic(i4_x0, i4_y0, i4_xD, i4_yD, pu1_refarray_luma, |
1682 | 0 | pu1_refarray_cb, pu1_refarray_cr); |
1683 | 0 | } |
1684 | | |
1685 | | /* Call the diagonal construction for the 2 rows */ |
1686 | 0 | if(i4_top == i4_left) |
1687 | 0 | { |
1688 | | /* if top * left = 1 */ |
1689 | | /* (x0,y0) */ |
1690 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x0, i4_y0, i4_xD, i4_yD, |
1691 | 0 | pu1_refarray_luma, DYADIC_REF_W_Y); |
1692 | |
|
1693 | 0 | pu1_tmp_dst = pu1_refarray_luma + ((i4_y0 + 1) * DYADIC_REF_W_Y); |
1694 | | |
1695 | | /* (x0+1,y0), ..., (x0+7,y0) and */ |
1696 | | /* (x0,y0+1), ..., (x0+6,y0+1) */ |
1697 | 0 | for(i4_x = i4_x0 + 1; i4_x < i4_x0 + 8; i4_x++) |
1698 | 0 | { |
1699 | 0 | i4_xD++; |
1700 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic( |
1701 | 0 | i4_x, i4_y0, i4_xD, i4_yD, pu1_refarray_luma, DYADIC_REF_W_Y); |
1702 | 0 | pu1_tmp_dst[i4_x - 1] = u1_filled_samp; |
1703 | 0 | } |
1704 | | |
1705 | | /* (x0+7,y0+1) */ |
1706 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic( |
1707 | 0 | i4_x0 + 7, i4_y0 + 1, i4_xD, i4_yD + 1, pu1_refarray_luma, DYADIC_REF_W_Y); |
1708 | 0 | } |
1709 | 0 | else |
1710 | 0 | { |
1711 | | /* top * left = -1 */ |
1712 | | /* (x0,y0+1) */ |
1713 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x0, i4_y0 + 1, i4_xD, i4_yD + 1, |
1714 | 0 | pu1_refarray_luma, DYADIC_REF_W_Y); |
1715 | |
|
1716 | 0 | pu1_tmp_dst = pu1_refarray_luma + ((i4_y0 + 1) * DYADIC_REF_W_Y); |
1717 | | |
1718 | | /* (x0,y0), ..., (x0,y0+6) and */ |
1719 | | /* (x0+1,y0+1), ..., (x0+1,y0+7) */ |
1720 | 0 | for(i4_x = i4_x0; i4_x < i4_x0 + 7; i4_x++) |
1721 | 0 | { |
1722 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic( |
1723 | 0 | i4_x, i4_y0, i4_xD, i4_yD, pu1_refarray_luma, DYADIC_REF_W_Y); |
1724 | |
|
1725 | 0 | pu1_tmp_dst[i4_x + 1] = u1_filled_samp; |
1726 | 0 | i4_xD++; |
1727 | 0 | } |
1728 | | |
1729 | | /* (x0+7,y0) */ |
1730 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x0 + 7, i4_y0, i4_xD, i4_yD, |
1731 | 0 | pu1_refarray_luma, DYADIC_REF_W_Y); |
1732 | 0 | } |
1733 | | |
1734 | | /* For Cb and Cr */ |
1735 | 0 | for(i4_x = i4_xc0; i4_x < i4_xc0 + 4; i4_x++) |
1736 | 0 | { |
1737 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x, i4_yc0, i4_c_xD, i4_c_yD, |
1738 | 0 | pu1_refarray_cb, DYADIC_REF_W_C); |
1739 | 0 | u1_filled_samp = isvc_diagonal_construct_dyadic(i4_x, i4_yc0, i4_c_xD, i4_c_yD, |
1740 | 0 | pu1_refarray_cr, DYADIC_REF_W_C); |
1741 | 0 | i4_c_xD++; |
1742 | 0 | } |
1743 | 0 | } |
1744 | 5.59M | } |
1745 | | |
1746 | 5.55M | if(!(u1_ny_avlblty & TOPLEFT_MASK)) |
1747 | 0 | { |
1748 | 0 | UWORD8 *pu1_tmp_dst1, *pu1_tmp_dst2; |
1749 | 0 | UWORD8 *pu1_tmp_src1, *pu1_tmp_src2; |
1750 | |
|
1751 | 0 | if(u1_ny_avlblty & LEFT_MASK) |
1752 | 0 | { |
1753 | | /* (mb_x+left,mb_y) available, (mb_x,mb_y+top) unavailable */ |
1754 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1755 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1756 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1757 | | |
1758 | | /* Copy (x0,ref_yD), (x0+1,ref_yD) to */ |
1759 | | /* (x0,y0), (x0+1,y0), and (x0,y0+1), (x0+1,y0+1) */ |
1760 | 0 | pu1_tmp_src1 = pu1_refarray_luma + (i4_ref_yD * DYADIC_REF_W_Y); |
1761 | 0 | pu1_tmp_dst1 = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1762 | 0 | pu1_tmp_dst2 = pu1_tmp_dst1 + DYADIC_REF_W_Y; |
1763 | |
|
1764 | 0 | pu1_tmp_dst1[i4_x0] = pu1_tmp_src1[i4_x0]; |
1765 | 0 | pu1_tmp_dst2[i4_x0] = pu1_tmp_src1[i4_x0]; |
1766 | 0 | pu1_tmp_dst1[i4_x0 + 1] = pu1_tmp_src1[i4_x0 + 1]; |
1767 | 0 | pu1_tmp_dst2[i4_x0 + 1] = pu1_tmp_src1[i4_x0 + 1]; |
1768 | | |
1769 | | /* Cb and Cr copy */ |
1770 | 0 | i4_xc0 = i4_x0 >> 1; |
1771 | 0 | i4_yc0 = i4_y0 >> 1; |
1772 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1773 | |
|
1774 | 0 | pu1_tmp_src1 = pu1_refarray_cb + (i4_c_ref_yD * DYADIC_REF_W_C); |
1775 | 0 | pu1_tmp_dst1 = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1776 | 0 | pu1_tmp_src2 = pu1_refarray_cr + (i4_c_ref_yD * DYADIC_REF_W_C); |
1777 | 0 | pu1_tmp_dst2 = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1778 | |
|
1779 | 0 | pu1_tmp_dst1[i4_xc0] = pu1_tmp_src1[i4_xc0]; |
1780 | 0 | pu1_tmp_dst2[i4_xc0] = pu1_tmp_src2[i4_xc0]; |
1781 | 0 | } |
1782 | 0 | else if(u1_ny_avlblty & TOP_MASK) |
1783 | 0 | { |
1784 | | /* (mb_x+left,mb_y) unavailable, |
1785 | | (mb_x,mb_y+top) available */ |
1786 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1787 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1788 | 0 | i4_ref_xD = i4_x0 - i4_left - (i4_left >> 1); |
1789 | | |
1790 | | /* Copy (ref_xD,y0) to (x0,y0) and (x0+1,y0) */ |
1791 | | /* copy (ref_xD,y0+1) to (x0,y0+1) and (x0+1,y0+1) */ |
1792 | 0 | pu1_tmp_src1 = pu1_refarray_luma + (i4_y0 * DYADIC_REF_W_Y); |
1793 | 0 | pu1_tmp_dst1 = pu1_tmp_src1; |
1794 | 0 | pu1_tmp_src2 = pu1_tmp_src1 + DYADIC_REF_W_Y; |
1795 | 0 | pu1_tmp_dst2 = pu1_tmp_src2; |
1796 | |
|
1797 | 0 | pu1_tmp_dst1[i4_x0] = pu1_tmp_src1[i4_ref_xD]; |
1798 | 0 | pu1_tmp_dst1[i4_x0 + 1] = pu1_tmp_src1[i4_ref_xD]; |
1799 | 0 | pu1_tmp_dst2[i4_x0] = pu1_tmp_src2[i4_ref_xD]; |
1800 | 0 | pu1_tmp_dst2[i4_x0 + 1] = pu1_tmp_src2[i4_ref_xD]; |
1801 | | |
1802 | | /* Copy Cb and Cr */ |
1803 | 0 | i4_xc0 = i4_x0 >> 1; |
1804 | 0 | i4_yc0 = i4_y0 >> 1; |
1805 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1806 | |
|
1807 | 0 | pu1_tmp_src1 = pu1_refarray_cb + (i4_yc0 * DYADIC_REF_W_C); |
1808 | 0 | pu1_tmp_dst1 = pu1_tmp_src1; |
1809 | 0 | pu1_tmp_src2 = pu1_refarray_cr + (i4_yc0 * DYADIC_REF_W_C); |
1810 | 0 | pu1_tmp_dst2 = pu1_tmp_src2; |
1811 | |
|
1812 | 0 | pu1_tmp_dst1[i4_xc0] = pu1_tmp_src1[i4_c_ref_xD]; |
1813 | 0 | pu1_tmp_dst2[i4_xc0] = pu1_tmp_src2[i4_c_ref_xD]; |
1814 | 0 | } |
1815 | 0 | else if(u1_ny_avlblty & (TOP_MASK | LEFT_MASK)) |
1816 | 0 | { |
1817 | | /* (mb_x+left,mb_y) available, |
1818 | | (mb_x,mb_y+top) available */ |
1819 | 0 | WORD32 i4_xD, i4_yD; |
1820 | 0 | WORD32 i4_c_xD, i4_c_yD; |
1821 | |
|
1822 | 0 | i4_y0 = 9 + (i4_top << 3) + i4_top; |
1823 | 0 | i4_x0 = 9 + (i4_left << 3) + i4_left; |
1824 | |
|
1825 | 0 | i4_ref_xD = i4_x0 - i4_left - (i4_left >> 1); |
1826 | 0 | i4_ref_yD = i4_y0 - i4_top - (i4_top >> 1); |
1827 | |
|
1828 | 0 | i4_xD = i4_x0 - i4_ref_xD; |
1829 | 0 | i4_yD = i4_y0 - i4_ref_yD; |
1830 | |
|
1831 | 0 | i4_xc0 = i4_x0 >> 1; |
1832 | 0 | i4_yc0 = i4_y0 >> 1; |
1833 | |
|
1834 | 0 | i4_c_ref_xD = i4_ref_xD >> 1; |
1835 | 0 | i4_c_ref_yD = i4_ref_yD >> 1; |
1836 | |
|
1837 | 0 | i4_c_xD = i4_xc0 - i4_c_ref_xD; |
1838 | 0 | i4_c_yD = i4_yc0 - i4_c_ref_yD; |
1839 | | |
1840 | | /* Call diagonal construction for luma */ |
1841 | 0 | for(i4_y = i4_y0; i4_y < i4_y0 + 2; i4_y++) |
1842 | 0 | { |
1843 | 0 | for(i4_x = i4_x0; i4_x < i4_x0 + 2; i4_x++) |
1844 | 0 | { |
1845 | 0 | isvc_diagonal_construct_dyadic(i4_x, i4_y, i4_xD, i4_yD, pu1_refarray_luma, |
1846 | 0 | DYADIC_REF_W_Y); |
1847 | 0 | i4_xD++; |
1848 | 0 | } |
1849 | 0 | i4_yD++; |
1850 | 0 | i4_xD -= 2; |
1851 | 0 | } |
1852 | | |
1853 | | /* Call diagonal construction for chroma */ |
1854 | 0 | isvc_diagonal_construct_dyadic(i4_xc0, i4_yc0, i4_c_xD, i4_c_yD, pu1_refarray_cb, |
1855 | 0 | DYADIC_REF_W_C); |
1856 | |
|
1857 | 0 | isvc_diagonal_construct_dyadic(i4_xc0, i4_yc0, i4_c_xD, i4_c_yD, pu1_refarray_cr, |
1858 | 0 | DYADIC_REF_W_C); |
1859 | 0 | } |
1860 | 0 | } |
1861 | 5.55M | } |
1862 | | |
1863 | | /*****************************************************************************/ |
1864 | | /* */ |
1865 | | /* Function Name : isvc_get_ref_layer_mbtype */ |
1866 | | /* */ |
1867 | | /* Description : This function is used to find the mb type of the */ |
1868 | | /* corresponding MB in the reference layer */ |
1869 | | /* */ |
1870 | | /* Inputs : pv_intra_samp_ctxt : intra samp context */ |
1871 | | /* pi1_ref_mb_modes : ref mb modes buffer pointer */ |
1872 | | /* i4_ref_mode_stride : mb mode buffer stride */ |
1873 | | /* i4_x_ref : reference location X */ |
1874 | | /* i4_y_ref : reference location Y */ |
1875 | | /* pi4_mb_type : pointer to store the mb type */ |
1876 | | /* i4_chroma_flag : chroma flag */ |
1877 | | /* Globals : none */ |
1878 | | /* Processing : it derives the bit corresponding to reference MB and */ |
1879 | | /* stores the mbtype as INTRA if the bit is set */ |
1880 | | /* Outputs : none */ |
1881 | | /* Returns : none */ |
1882 | | /* */ |
1883 | | /* Issues : none */ |
1884 | | /* */ |
1885 | | /* Revision History: */ |
1886 | | /* */ |
1887 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1888 | | /* 26 06 2009 vijayakumar creation */ |
1889 | | /* */ |
1890 | | /*****************************************************************************/ |
1891 | | static WORD8 isvc_get_ref_layer_mbtype(WORD8 *pi1_ref_mb_modes, WORD32 *pi4_mb_type, |
1892 | | WORD8 i1_curr_slice_id, WORD8 i1_cons_intr_samp_flag) |
1893 | 0 | { |
1894 | 0 | WORD8 i1_intra_slice_id; |
1895 | 0 | WORD8 i1_mb_mode; |
1896 | |
|
1897 | 0 | i1_mb_mode = *pi1_ref_mb_modes; |
1898 | 0 | i1_mb_mode = (i1_mb_mode < 0) ? i1_mb_mode : SVC_EXTRACT_MB_MODE(*pi1_ref_mb_modes); |
1899 | |
|
1900 | 0 | if(i1_mb_mode <= SVC_INTER_MB) |
1901 | 0 | { |
1902 | 0 | *pi4_mb_type = SVC_INTER_MB; |
1903 | 0 | i1_intra_slice_id = -1; |
1904 | 0 | } |
1905 | 0 | else |
1906 | 0 | { |
1907 | 0 | *pi4_mb_type = SVC_INTRA_MB; |
1908 | 0 | i1_intra_slice_id = i1_mb_mode; |
1909 | |
|
1910 | 0 | if(1 == i1_cons_intr_samp_flag) |
1911 | 0 | { |
1912 | 0 | if(i1_mb_mode != i1_curr_slice_id) |
1913 | 0 | { |
1914 | 0 | *pi4_mb_type = SVC_INTER_MB; |
1915 | 0 | } |
1916 | 0 | } |
1917 | 0 | } |
1918 | 0 | return i1_intra_slice_id; |
1919 | 0 | } |
1920 | | |
1921 | | /*****************************************************************************/ |
1922 | | /* */ |
1923 | | /* Function Name : isvc_fill_non_ava_pixel */ |
1924 | | /* */ |
1925 | | /* Description : This function does the core pixel level processing */ |
1926 | | /* while filling the non available pixel */ |
1927 | | /* */ |
1928 | | /* Inputs : pv_intra_samp_ctxt : intra sampling context */ |
1929 | | /* i4_refarray_wd : width of the reference array */ |
1930 | | /* i4_refarray_ht : height of the reference array */ |
1931 | | /* ps_mb_coord : current mb coord structure */ |
1932 | | /* i4_chroma_flag : chroam processing flag */ |
1933 | | /* Globals : none */ |
1934 | | /* Processing : based on the map buffer values the non available pixels */ |
1935 | | /* are filled using border extension algorithm */ |
1936 | | /* Outputs : none */ |
1937 | | /* Returns : none */ |
1938 | | /* */ |
1939 | | /* Issues : none */ |
1940 | | /* */ |
1941 | | /* Revision History: */ |
1942 | | /* */ |
1943 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1944 | | /* 26 06 2009 vijayakumar creation */ |
1945 | | /* 07 03 2011 A.D.Almeida Optimized the filling pixels */ |
1946 | | /* */ |
1947 | | /*****************************************************************************/ |
1948 | | static void isvc_fill_non_avail_pixel(intra_samp_lyr_ctxt *ps_lyr_ctxt, UWORD8 *pu1_refarray_1, |
1949 | | UWORD8 *pu1_refarray_2, WORD32 i4_refarray_stride, |
1950 | | WORD32 i4_chroma_flag, UWORD8 u1_avail_map[4][4]) |
1951 | 0 | { |
1952 | 0 | WORD32 i4_x, i4_y; |
1953 | 0 | WORD32 i4_corner_pixel_available; |
1954 | |
|
1955 | 0 | seg_lookup_desc_t *ps_segments_x; |
1956 | 0 | seg_lookup_desc_t *ps_segments_y; |
1957 | 0 | seg_description_t *ps_seg_desc_x, *ps_seg_desc_y; |
1958 | 0 | seg_description_t *ps_seg_x_tmp, *ps_seg_y_tmp; |
1959 | 0 | UWORD8 u1_num_sgmts_x, u1_num_sgmts_y; |
1960 | |
|
1961 | 0 | WORD32 i4_x_offset; |
1962 | 0 | WORD32 i4_y_offset; |
1963 | 0 | WORD32 i4_refmb_wd; |
1964 | 0 | WORD32 i4_refmb_ht; |
1965 | 0 | WORD32 i4_xr_index, i4_yr_index; |
1966 | 0 | WORD32 i4_j, i4_i; |
1967 | 0 | WORD32 i4_cur_x; |
1968 | 0 | UWORD32 u4_lookup_4bit, u4_lookup_5bit, u4_4thbit; |
1969 | 0 | WORD32 i4_pad_size; |
1970 | |
|
1971 | 0 | WORD32 i4_x_min; |
1972 | 0 | WORD32 i4_y_min; |
1973 | 0 | WORD32 i4_x_start_pos, i4_y_start_pos; |
1974 | |
|
1975 | 0 | UWORD8 *pu1_ref_idx_x, *pu1_ref_idx_y; |
1976 | |
|
1977 | 0 | PF_INTRA_SAMP_PADDING *pf_intra_samp_padding; |
1978 | 0 | PF_INTRA_SAMP_PADDING **pf_intra_samp_lookup; |
1979 | |
|
1980 | 0 | i4_x_offset = ps_lyr_ctxt->ps_offsets->i4_abscissa; |
1981 | 0 | i4_y_offset = ps_lyr_ctxt->ps_offsets->i4_ordinate; |
1982 | |
|
1983 | 0 | i4_refmb_wd = (MB_SIZE >> i4_chroma_flag) - 1; |
1984 | 0 | i4_refmb_ht = (MB_SIZE >> i4_chroma_flag) - 1; |
1985 | |
|
1986 | 0 | if(0 == i4_chroma_flag) |
1987 | 0 | { |
1988 | 0 | pf_intra_samp_lookup = gpf_lookup_fxns_luma; |
1989 | 0 | } |
1990 | 0 | else |
1991 | 0 | { |
1992 | 0 | pf_intra_samp_lookup = gpf_lookup_fxns_chroma; |
1993 | 0 | } |
1994 | |
|
1995 | 0 | i4_x_min = ps_lyr_ctxt->i2_x_min_pos; |
1996 | 0 | i4_y_min = ps_lyr_ctxt->i2_y_min_pos; |
1997 | |
|
1998 | 0 | i4_pad_size = 2 >> i4_chroma_flag; |
1999 | 0 | i4_x_start_pos = (i4_x_min - i4_pad_size); |
2000 | 0 | i4_y_start_pos = (i4_y_min - i4_pad_size); |
2001 | |
|
2002 | 0 | i4_xr_index = (i4_x_start_pos + i4_x_offset) & i4_refmb_wd; |
2003 | 0 | i4_yr_index = (i4_y_start_pos + i4_y_offset) & i4_refmb_ht; |
2004 | |
|
2005 | 0 | ps_segments_x = (ps_lyr_ctxt->as_seg_lookup_horz + i4_xr_index); |
2006 | 0 | ps_segments_y = (ps_lyr_ctxt->as_seg_lookup_vert + i4_yr_index); |
2007 | |
|
2008 | 0 | u1_num_sgmts_x = ps_segments_x->u1_num_segments; |
2009 | 0 | u1_num_sgmts_y = ps_segments_y->u1_num_segments; |
2010 | |
|
2011 | 0 | ps_seg_desc_x = ps_segments_x->s_segments; |
2012 | 0 | ps_seg_desc_y = ps_segments_y->s_segments; |
2013 | |
|
2014 | 0 | pu1_ref_idx_x = &(ps_lyr_ctxt->au1_refarray_x_idx[0]); |
2015 | 0 | pu1_ref_idx_y = &(ps_lyr_ctxt->au1_refarray_y_idx[0]); |
2016 | |
|
2017 | 0 | i4_cur_x = pu1_ref_idx_x[i4_x_start_pos]; |
2018 | |
|
2019 | 0 | u4_4thbit = ps_segments_x->u4_start_pos; |
2020 | |
|
2021 | 0 | for(i4_j = 0; i4_j < u1_num_sgmts_y; i4_j++) |
2022 | 0 | { |
2023 | 0 | UWORD8 i4_idx_a, i4_idx_b; |
2024 | 0 | UWORD8 u1_seg_ht, u1_seg_wd; |
2025 | 0 | UWORD8 u1_mb_adjoin_x, u1_mb_adjoin_y; |
2026 | 0 | WORD8 i1_nearst_mb_bdry_x, i1_nearst_mb_bdry_y; |
2027 | 0 | UWORD32 u4_num_valid_segs; |
2028 | 0 | WORD32 i4_idx_a_plus_ny, i4_idx_b_plus_nx, i4_index; |
2029 | 0 | WORD8 i1_yd_index, i1_xd_index; |
2030 | |
|
2031 | 0 | ps_seg_y_tmp = &ps_seg_desc_y[i4_j]; |
2032 | |
|
2033 | 0 | i4_y = i4_y_start_pos + ps_seg_y_tmp->u1_seg_off; |
2034 | 0 | u1_seg_ht = ps_seg_y_tmp->u1_seg_dim; |
2035 | 0 | i1_yd_index = ps_seg_y_tmp->i1_dist_idx; |
2036 | 0 | i1_nearst_mb_bdry_y = ps_seg_y_tmp->i1_nearst_mb_bdry; |
2037 | 0 | u1_mb_adjoin_y = ps_seg_y_tmp->u1_mb_adjoin; |
2038 | |
|
2039 | 0 | i4_idx_a = pu1_ref_idx_y[i4_y]; |
2040 | |
|
2041 | 0 | i4_idx_a_plus_ny = (i4_idx_a + i1_nearst_mb_bdry_y); |
2042 | | |
2043 | | /* Pack the availabilities of the next three horizontal MBs in 3bit |
2044 | | format and 4th bit indicating if the start position is greater |
2045 | | than the mb_width/2 |
2046 | | */ |
2047 | 0 | u4_lookup_4bit = u4_4thbit | u1_avail_map[i4_idx_a][i4_cur_x + 2] << 2 | |
2048 | 0 | u1_avail_map[i4_idx_a][i4_cur_x + 1] << 1 | |
2049 | 0 | u1_avail_map[i4_idx_a][i4_cur_x]; |
2050 | |
|
2051 | 0 | u4_num_valid_segs = gu4_valid_segs_lookup[u4_lookup_4bit]; |
2052 | |
|
2053 | 0 | i4_i = CLZ(~u4_num_valid_segs); |
2054 | 0 | u4_num_valid_segs <<= (i4_i + 1); |
2055 | |
|
2056 | 0 | for(; i4_i < u1_num_sgmts_x; i4_i++) |
2057 | 0 | { |
2058 | 0 | ps_seg_x_tmp = &ps_seg_desc_x[i4_i]; |
2059 | |
|
2060 | 0 | i4_x = i4_x_start_pos + ps_seg_x_tmp->u1_seg_off; |
2061 | 0 | i4_idx_b = pu1_ref_idx_x[i4_x]; |
2062 | |
|
2063 | 0 | u1_seg_wd = ps_seg_x_tmp->u1_seg_dim; |
2064 | 0 | i1_xd_index = ps_seg_x_tmp->i1_dist_idx; |
2065 | 0 | i1_nearst_mb_bdry_x = ps_seg_x_tmp->i1_nearst_mb_bdry; |
2066 | 0 | u1_mb_adjoin_x = ps_seg_x_tmp->u1_mb_adjoin; |
2067 | |
|
2068 | 0 | i4_idx_b_plus_nx = (i4_idx_b + i1_nearst_mb_bdry_x); |
2069 | | |
2070 | | /* Find the avalability of (x,y-Yd),(x-Xd,y),(x-Xd,y-Yd) and pack |
2071 | | it to 3 bits. |
2072 | | */ |
2073 | 0 | u4_lookup_5bit = u1_avail_map[i4_idx_a_plus_ny][i4_idx_b_plus_nx] << 2 | |
2074 | 0 | u1_avail_map[i4_idx_a_plus_ny][i4_idx_b] << 1 | |
2075 | 0 | u1_avail_map[i4_idx_a][i4_idx_b_plus_nx] | u1_mb_adjoin_x | |
2076 | 0 | u1_mb_adjoin_y; |
2077 | |
|
2078 | 0 | i4_corner_pixel_available = u1_avail_map[i4_idx_a_plus_ny][i4_idx_b_plus_nx]; |
2079 | | |
2080 | | /* Use a function pointer table based on lookup to compute |
2081 | | Left,Top,Bottom,Right,Diagonal padding. |
2082 | | */ |
2083 | 0 | pf_intra_samp_padding = pf_intra_samp_lookup[u4_lookup_5bit]; |
2084 | |
|
2085 | 0 | if(pf_intra_samp_padding != NULL) |
2086 | 0 | { |
2087 | 0 | pf_intra_samp_padding(i4_x, i4_y, i1_xd_index, i1_yd_index, u1_seg_wd, u1_seg_ht, |
2088 | 0 | pu1_refarray_1, pu1_refarray_2, i4_refarray_stride, |
2089 | 0 | u1_mb_adjoin_x, u1_mb_adjoin_y, i4_corner_pixel_available); |
2090 | 0 | } |
2091 | | |
2092 | | /* increment to the next unavailable segment */ |
2093 | 0 | i4_index = CLZ(~u4_num_valid_segs); |
2094 | 0 | u4_num_valid_segs <<= (i4_index + 1); |
2095 | 0 | i4_i += i4_index; |
2096 | 0 | } |
2097 | 0 | } |
2098 | 0 | } |
2099 | | |
2100 | | /*****************************************************************************/ |
2101 | | /* */ |
2102 | | /* Function Name : isvc_intra_resamp_generate_segment_lookup */ |
2103 | | /* */ |
2104 | | /* Description : This function generates segment lookup used to derive */ |
2105 | | /* segments which have to be be intra resampled */ |
2106 | | /* */ |
2107 | | /* Inputs : pv_lookup_table : look up table */ |
2108 | | /* i4_dimension : dimension of the block which is used in*/ |
2109 | | /* resampling process. */ |
2110 | | /* i4_mb_size : size of the mb */ |
2111 | | /* Globals : None */ |
2112 | | /* Processing : This function generates segment lookup used to derive */ |
2113 | | /* segments which have to be be intra resampled */ |
2114 | | /* Outputs : none */ |
2115 | | /* Returns : none */ |
2116 | | /* */ |
2117 | | /* Issues : None */ |
2118 | | /* */ |
2119 | | /* Revision History: */ |
2120 | | /* */ |
2121 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
2122 | | /* 03 03 2011 A.D.Almeida Creation */ |
2123 | | /* */ |
2124 | | void isvc_intra_resamp_generate_segment_lookup(seg_lookup_desc_t *ps_seg_lookup_table, |
2125 | | WORD32 i4_dimension, WORD32 i4_mb_size, |
2126 | | WORD32 i4_shift_val) |
2127 | 0 | { |
2128 | 0 | WORD32 i4_x; |
2129 | 0 | WORD32 i4_position, i4_dist_prev_mb, i4_dist_next_mb; |
2130 | 0 | UWORD8 u1_seg_dim; |
2131 | 0 | UWORD8 u1_num_sgmts; |
2132 | 0 | WORD32 i4_block_size = i4_mb_size >> 1; |
2133 | 0 | UWORD8 u1_offset = 0; |
2134 | 0 | seg_lookup_desc_t *ps_segments; |
2135 | 0 | seg_description_t *ps_seg_desc; |
2136 | |
|
2137 | 0 | memset(ps_seg_lookup_table, 0, i4_mb_size * sizeof(seg_lookup_desc_t)); |
2138 | |
|
2139 | 0 | for(i4_x = 0; i4_x < i4_mb_size; i4_x++) |
2140 | 0 | { |
2141 | 0 | ps_segments = &ps_seg_lookup_table[i4_x]; |
2142 | 0 | ps_seg_desc = ps_segments->s_segments; |
2143 | 0 | i4_position = i4_x; |
2144 | |
|
2145 | 0 | if(i4_x >= i4_block_size) |
2146 | 0 | { |
2147 | | /* set the fourth bit so that later it can be directly OR ed */ |
2148 | 0 | ps_segments->u4_start_pos = 8; |
2149 | 0 | } |
2150 | 0 | else |
2151 | 0 | { |
2152 | 0 | ps_segments->u4_start_pos = 0; |
2153 | 0 | } |
2154 | |
|
2155 | 0 | u1_num_sgmts = 0; |
2156 | 0 | u1_offset = 0; |
2157 | |
|
2158 | 0 | while(i4_position < (i4_x + i4_dimension)) |
2159 | 0 | { |
2160 | | /* check and fill the nearest mb boundry flag */ |
2161 | 0 | if((i4_position & (i4_mb_size - 1)) < i4_block_size) |
2162 | 0 | { |
2163 | 0 | ps_seg_desc->i1_nearst_mb_bdry = -1; |
2164 | 0 | } |
2165 | 0 | else |
2166 | 0 | { |
2167 | 0 | ps_seg_desc->i1_nearst_mb_bdry = 1; |
2168 | 0 | } |
2169 | | |
2170 | | /* find the distance from the previous MB for start of segment*/ |
2171 | 0 | i4_dist_prev_mb = (i4_position & (i4_mb_size - 1)); |
2172 | |
|
2173 | 0 | ps_seg_desc->i1_dist_idx = |
2174 | 0 | ((i4_dist_prev_mb >= i4_mb_size >> 1) ? (i4_mb_size - i4_dist_prev_mb) |
2175 | 0 | : -(i4_dist_prev_mb + 1)); |
2176 | | |
2177 | | /* find the size of the segment */ |
2178 | 0 | u1_seg_dim = (i4_block_size - (i4_position & (i4_block_size - 1))); |
2179 | 0 | i4_position += u1_seg_dim; |
2180 | 0 | if(i4_position > (i4_x + i4_dimension)) |
2181 | 0 | { |
2182 | 0 | i4_position = (i4_x + i4_dimension); |
2183 | 0 | u1_seg_dim = (i4_position & (i4_block_size - 1)); |
2184 | 0 | } |
2185 | | |
2186 | | /* find the distance from the next MB for end of segment */ |
2187 | 0 | i4_dist_next_mb = (i4_position & (i4_mb_size - 1)); |
2188 | |
|
2189 | 0 | ps_seg_desc->u1_seg_dim = u1_seg_dim; |
2190 | 0 | ps_seg_desc->u1_seg_off = u1_offset; |
2191 | | |
2192 | | /* check if the segment has a adjoining MB edge */ |
2193 | 0 | if(i4_dist_prev_mb == 0) |
2194 | 0 | { |
2195 | 0 | if(0 == u1_num_sgmts) |
2196 | 0 | { |
2197 | 0 | ps_seg_desc->u1_mb_adjoin = 0; |
2198 | 0 | } |
2199 | 0 | else |
2200 | 0 | { |
2201 | 0 | ps_seg_desc->u1_mb_adjoin = 1 << i4_shift_val; |
2202 | 0 | } |
2203 | 0 | } |
2204 | 0 | else if(i4_dist_next_mb == 0) |
2205 | 0 | { |
2206 | 0 | if(i4_position == (i4_x + i4_dimension)) |
2207 | 0 | { |
2208 | 0 | ps_seg_desc->u1_mb_adjoin = 0; |
2209 | 0 | } |
2210 | 0 | else |
2211 | 0 | { |
2212 | 0 | ps_seg_desc->u1_mb_adjoin = 1 << i4_shift_val; |
2213 | 0 | } |
2214 | 0 | } |
2215 | 0 | else |
2216 | 0 | { |
2217 | 0 | ps_seg_desc->u1_mb_adjoin = 0; |
2218 | 0 | } |
2219 | |
|
2220 | 0 | u1_offset += u1_seg_dim; |
2221 | 0 | u1_num_sgmts++; |
2222 | 0 | ps_seg_desc++; |
2223 | 0 | } |
2224 | | |
2225 | | /* fill the number of segments for this position */ |
2226 | 0 | ps_segments->u1_num_segments = u1_num_sgmts; |
2227 | 0 | } |
2228 | 0 | } |
2229 | | |
2230 | | static void isvc_reflayer_construction(void *pv_intra_samp_ctxt, UWORD8 *pu1_inp_1, |
2231 | | WORD32 i4_inp_stride, WORD32 i4_refarray_stride, |
2232 | | mem_element_t *ps_ref_mb_mode_map, WORD32 i4_chroma_flag) |
2233 | 0 | { |
2234 | 0 | WORD32 i4_x, i4_y; |
2235 | |
|
2236 | 0 | intra_sampling_ctxt_t *ps_ctxt; |
2237 | 0 | intra_samp_lyr_ctxt *ps_lyr_ctxt; |
2238 | 0 | WORD8 *pi1_ref_mb_modes, *pi1_ref_mb_modes_bkp_1; |
2239 | 0 | WORD32 i4_ref_mode_stride; |
2240 | 0 | WORD32 i4_element_size; |
2241 | 0 | WORD32 i4_dummy; |
2242 | 0 | WORD32 i4_mb_ht, i4_mb_wd; |
2243 | | |
2244 | | /* 4x4 mb grid buffer to store the mb availablity */ |
2245 | 0 | UWORD8 u1_map_buf[BLK_SIZE][BLK_SIZE]; |
2246 | 0 | WORD32 i4_ref_wd; |
2247 | 0 | WORD32 i4_ref_ht; |
2248 | 0 | WORD32 i4_x_offset; |
2249 | 0 | WORD32 i4_y_offset; |
2250 | 0 | WORD32 i4_refarray_wd; |
2251 | 0 | WORD32 i4_refarray_ht; |
2252 | 0 | WORD32 i4_mb_type; |
2253 | 0 | WORD8 i1_cons_intr_samp_flag; |
2254 | 0 | WORD8 i1_slice_id = 0; |
2255 | 0 | WORD32 i4_mb_wd_sft, i4_mb_ht_sft; |
2256 | |
|
2257 | 0 | WORD32 i4_unfill_check; |
2258 | 0 | UWORD8 *pu1_refarray_1, *pu1_refarray_2; |
2259 | |
|
2260 | 0 | UNUSED(i4_dummy); |
2261 | 0 | memset(&u1_map_buf[0][0], 0, 16); |
2262 | |
|
2263 | 0 | ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt; |
2264 | 0 | ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id]; |
2265 | 0 | pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer; |
2266 | 0 | i4_ref_mode_stride = ps_ref_mb_mode_map->i4_num_element_stride; |
2267 | 0 | i4_element_size = ps_ref_mb_mode_map->i4_element_size; |
2268 | | |
2269 | | /* get the condtrained intra sampling flag */ |
2270 | 0 | i1_cons_intr_samp_flag = ps_lyr_ctxt->i1_constrained_intra_rsmpl_flag; |
2271 | |
|
2272 | 0 | ASSERT(NULL != pi1_ref_mb_modes); |
2273 | | |
2274 | 0 | { |
2275 | 0 | WORD32 i4_base_width = ps_lyr_ctxt->i4_ref_width; |
2276 | 0 | WORD32 i4_base_height = ps_lyr_ctxt->i4_ref_height; |
2277 | |
|
2278 | 0 | i4_ref_wd = i4_base_width >> i4_chroma_flag; |
2279 | 0 | i4_ref_ht = i4_base_height >> i4_chroma_flag; |
2280 | |
|
2281 | 0 | i4_mb_wd_sft = (MB_WIDTH_SHIFT - i4_chroma_flag); |
2282 | 0 | i4_mb_ht_sft = (MB_HEIGHT_SHIFT - i4_chroma_flag); |
2283 | 0 | } |
2284 | |
|
2285 | 0 | i4_x_offset = ps_lyr_ctxt->ps_offsets->i4_abscissa; |
2286 | 0 | i4_y_offset = ps_lyr_ctxt->ps_offsets->i4_ordinate; |
2287 | 0 | i4_refarray_wd = ps_lyr_ctxt->ps_ref_array_dims->i4_abscissa; |
2288 | 0 | i4_refarray_ht = ps_lyr_ctxt->ps_ref_array_dims->i4_ordinate; |
2289 | |
|
2290 | 0 | i4_mb_wd = (MB_SIZE >> i4_chroma_flag); |
2291 | 0 | i4_mb_ht = (MB_SIZE >> i4_chroma_flag); |
2292 | |
|
2293 | 0 | if(1 == i1_cons_intr_samp_flag) |
2294 | 0 | { |
2295 | 0 | WORD32 i4_x_min, i4_x_max; |
2296 | 0 | WORD32 i4_y_min, i4_y_max; |
2297 | |
|
2298 | 0 | i4_x_min = ps_lyr_ctxt->i2_x_min_pos; |
2299 | 0 | i4_x_max = ps_lyr_ctxt->i2_x_max_pos; |
2300 | 0 | i4_y_min = ps_lyr_ctxt->i2_y_min_pos; |
2301 | 0 | i4_y_max = ps_lyr_ctxt->i2_y_max_pos; |
2302 | |
|
2303 | 0 | i4_mb_type = SVC_INTER_MB; |
2304 | 0 | { |
2305 | 0 | WORD32 i4_x_ref; |
2306 | 0 | WORD32 i4_y_ref; |
2307 | 0 | WORD32 i4_mb_x, i4_mb_y; |
2308 | | |
2309 | | /* derive local varaibles */ |
2310 | 0 | i4_y_ref = (i4_y_min + 1) + i4_y_offset; |
2311 | 0 | i4_x_ref = (i4_x_min + 1) + i4_x_offset; |
2312 | |
|
2313 | 0 | i4_mb_x = (i4_x_ref >> i4_mb_wd_sft); |
2314 | 0 | i4_mb_y = (i4_y_ref >> i4_mb_ht_sft); |
2315 | |
|
2316 | 0 | pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer; |
2317 | | |
2318 | | /* get the location of the byte which has the current mb mode */ |
2319 | 0 | pi1_ref_mb_modes += (i4_mb_y * i4_ref_mode_stride * i4_element_size); |
2320 | 0 | pi1_ref_mb_modes += (i4_mb_x * i4_element_size); |
2321 | 0 | } |
2322 | |
|
2323 | 0 | for(i4_y = (i4_y_min + 1); i4_y <= (i4_y_max - 1);) |
2324 | 0 | { |
2325 | 0 | WORD32 i4_x_ref; |
2326 | 0 | WORD32 i4_y_ref; |
2327 | 0 | WORD32 i4_distleftX, i4_rangeX; |
2328 | 0 | WORD32 i4_disttopY, i4_rangeY; |
2329 | |
|
2330 | 0 | i4_y_ref = (i4_y + i4_y_offset); |
2331 | 0 | i4_disttopY = (i4_y_ref) & (i4_mb_ht - 1); |
2332 | 0 | i4_rangeY = (i4_mb_ht - i4_disttopY); |
2333 | |
|
2334 | 0 | pi1_ref_mb_modes_bkp_1 = pi1_ref_mb_modes; |
2335 | |
|
2336 | 0 | for(i4_x = (i4_x_min + 1); i4_x <= (i4_x_max - 1);) |
2337 | 0 | { |
2338 | 0 | i4_x_ref = (i4_x + i4_x_offset); |
2339 | 0 | i4_distleftX = (i4_x_ref) & (i4_mb_wd - 1); |
2340 | 0 | i4_rangeX = (i4_mb_wd - i4_distleftX); |
2341 | | |
2342 | | /* get the referecne layer mb type */ |
2343 | 0 | i1_slice_id = |
2344 | 0 | isvc_get_ref_layer_mbtype(pi1_ref_mb_modes_bkp_1, &i4_mb_type, i1_slice_id, 0); |
2345 | 0 | if(SVC_INTRA_MB == i4_mb_type) |
2346 | 0 | { |
2347 | 0 | break; |
2348 | 0 | } |
2349 | 0 | i4_x += i4_rangeX; |
2350 | 0 | pi1_ref_mb_modes_bkp_1 += i4_element_size; |
2351 | 0 | } |
2352 | |
|
2353 | 0 | if(SVC_INTRA_MB == i4_mb_type) |
2354 | 0 | { |
2355 | 0 | break; |
2356 | 0 | } |
2357 | | |
2358 | 0 | i4_y += i4_rangeY; |
2359 | 0 | pi1_ref_mb_modes += (i4_ref_mode_stride * i4_element_size); |
2360 | 0 | } |
2361 | 0 | } |
2362 | 0 | else |
2363 | 0 | { |
2364 | 0 | i1_slice_id = -1; |
2365 | 0 | } |
2366 | |
|
2367 | 0 | i4_unfill_check = 0; |
2368 | | |
2369 | | /* --------------------------------------------------------------------- */ |
2370 | | /* Copying the data from recon buffer to refSample Array. |
2371 | | */ |
2372 | | /* NOTE: The copying of the data from recon buffer to refSample Array */ |
2373 | | /* can be optimized by bring in data at N-MB level,thus taking */ |
2374 | | /* advantage of the overlapping data which now gets copied every |
2375 | | * MB*/ |
2376 | | /* --------------------------------------------------------------------- */ |
2377 | 0 | { |
2378 | 0 | WORD32 i4_x_ref_start, i4_x_ref_end; |
2379 | 0 | WORD32 i4_y_ref_start, i4_y_ref_end; |
2380 | 0 | WORD32 i4_rangeW, i4_rangeH; |
2381 | 0 | WORD32 i4_offset; |
2382 | 0 | UWORD8 *pu1_src, *pu1_dst; |
2383 | 0 | UWORD8 *pu1_dst1, *pu1_dst2; |
2384 | | |
2385 | | /* Copy (refW x refH) dimension into reference sample array */ |
2386 | 0 | i4_x_ref_start = MAX(0, MIN((i4_ref_wd - 1), i4_x_offset)); |
2387 | 0 | i4_x_ref_end = MAX(0, MIN((i4_ref_wd - 1), (i4_refarray_wd - 1) + i4_x_offset)); |
2388 | 0 | i4_y_ref_start = MAX(0, MIN((i4_ref_ht - 1), i4_y_offset)); |
2389 | 0 | i4_y_ref_end = MAX(0, MIN((i4_ref_ht - 1), (i4_refarray_ht - 1) + i4_y_offset)); |
2390 | | |
2391 | | /* find the actual data to be copied */ |
2392 | 0 | i4_rangeW = (i4_x_ref_end - i4_x_ref_start + 1); |
2393 | 0 | i4_rangeH = (i4_y_ref_end - i4_y_ref_start + 1); |
2394 | | |
2395 | | /* get the reconbuffer pointer and ref sample array pointer */ |
2396 | 0 | i4_offset = |
2397 | 0 | (i4_x_ref_start - i4_x_offset) + ((i4_y_ref_start - i4_y_offset) * i4_refarray_stride); |
2398 | |
|
2399 | 0 | if(0 == i4_chroma_flag) |
2400 | 0 | { |
2401 | 0 | pu1_refarray_1 = ps_ctxt->pu1_refarray_buffer; |
2402 | 0 | pu1_refarray_2 = NULL; |
2403 | |
|
2404 | 0 | pu1_src = pu1_inp_1; |
2405 | 0 | pu1_dst = pu1_refarray_1 + i4_offset; |
2406 | | |
2407 | | /* Copy luma data into refsample array */ |
2408 | 0 | isvc_copy_data(pu1_src, i4_inp_stride, pu1_dst, i4_refarray_stride, i4_rangeW, |
2409 | 0 | i4_rangeH); |
2410 | 0 | } |
2411 | 0 | else |
2412 | 0 | { |
2413 | 0 | pu1_refarray_1 = ps_ctxt->pu1_refarray_buffer; |
2414 | 0 | pu1_refarray_2 = ps_ctxt->pu1_refarray_cb; |
2415 | |
|
2416 | 0 | pu1_src = pu1_inp_1; |
2417 | 0 | pu1_dst1 = pu1_refarray_1 + i4_offset; |
2418 | |
|
2419 | 0 | pu1_dst2 = pu1_refarray_2 + i4_offset; |
2420 | |
|
2421 | 0 | isvc_copy_data_semiplanr(pu1_src, i4_inp_stride, pu1_dst1, pu1_dst2, i4_refarray_stride, |
2422 | 0 | i4_rangeW, i4_rangeH); |
2423 | 0 | } |
2424 | 0 | } |
2425 | 0 | { |
2426 | 0 | WORD32 i4_i, i4_j; |
2427 | 0 | UWORD8 *pu1_ref_idx_x, *pu1_ref_idx_y; |
2428 | |
|
2429 | 0 | WORD32 i4_x_ref; |
2430 | 0 | WORD32 i4_y_ref; |
2431 | 0 | WORD32 i4_mb_x, i4_mb_y; |
2432 | |
|
2433 | 0 | i4_y_ref = i4_y_offset; |
2434 | 0 | i4_x_ref = i4_x_offset; |
2435 | |
|
2436 | 0 | i4_mb_x = (i4_x_ref >> i4_mb_wd_sft); |
2437 | 0 | i4_mb_y = (i4_y_ref >> i4_mb_ht_sft); |
2438 | |
|
2439 | 0 | pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer; |
2440 | |
|
2441 | 0 | pi1_ref_mb_modes += (i4_mb_y * i4_ref_mode_stride * i4_element_size); |
2442 | 0 | pi1_ref_mb_modes += (i4_mb_x * i4_element_size); |
2443 | |
|
2444 | 0 | pu1_ref_idx_x = &(ps_lyr_ctxt->au1_refarray_x_idx[0]); |
2445 | 0 | pu1_ref_idx_y = &(ps_lyr_ctxt->au1_refarray_y_idx[0]); |
2446 | |
|
2447 | 0 | i4_j = 0; |
2448 | 0 | for(i4_y = 0; i4_y < i4_refarray_ht;) |
2449 | 0 | { |
2450 | 0 | WORD32 i4_x_ref; |
2451 | 0 | WORD32 i4_y_ref; |
2452 | 0 | WORD32 i4_distleftX, i4_rangeX; |
2453 | 0 | WORD32 i4_disttopY, i4_rangeY; |
2454 | |
|
2455 | 0 | i4_y_ref = i4_y + i4_y_offset; |
2456 | 0 | i4_disttopY = (i4_y_ref) & (i4_mb_ht - 1); |
2457 | 0 | i4_rangeY = (i4_mb_ht - i4_disttopY); |
2458 | |
|
2459 | 0 | memset(pu1_ref_idx_y, i4_j, i4_rangeY); |
2460 | 0 | pu1_ref_idx_y += i4_rangeY; |
2461 | |
|
2462 | 0 | i4_i = 0; |
2463 | 0 | pi1_ref_mb_modes_bkp_1 = pi1_ref_mb_modes; |
2464 | 0 | for(i4_x = 0; i4_x < i4_refarray_wd;) |
2465 | 0 | { |
2466 | 0 | i4_x_ref = i4_x + i4_x_offset; |
2467 | 0 | i4_distleftX = (i4_x_ref) & (i4_mb_wd - 1); |
2468 | 0 | i4_rangeX = (i4_mb_wd - i4_distleftX); |
2469 | |
|
2470 | 0 | if(0 == i4_j) |
2471 | 0 | { |
2472 | 0 | memset(pu1_ref_idx_x, i4_i, i4_rangeX); |
2473 | 0 | pu1_ref_idx_x += i4_rangeX; |
2474 | 0 | } |
2475 | |
|
2476 | 0 | isvc_get_ref_layer_mbtype(pi1_ref_mb_modes_bkp_1, &i4_mb_type, i1_slice_id, |
2477 | 0 | i1_cons_intr_samp_flag); |
2478 | |
|
2479 | 0 | if(SVC_INTRA_MB == i4_mb_type) |
2480 | 0 | { |
2481 | 0 | u1_map_buf[i4_j][i4_i] = 1; |
2482 | 0 | i4_dummy = 1; |
2483 | 0 | } |
2484 | 0 | else |
2485 | 0 | { |
2486 | 0 | i4_unfill_check = 1; |
2487 | 0 | } |
2488 | |
|
2489 | 0 | i4_x = i4_x + i4_rangeX; |
2490 | 0 | i4_i++; |
2491 | 0 | pi1_ref_mb_modes_bkp_1 += i4_element_size; |
2492 | 0 | } |
2493 | 0 | i4_j++; |
2494 | 0 | i4_y = i4_y + i4_rangeY; |
2495 | 0 | pi1_ref_mb_modes += (i4_ref_mode_stride * i4_element_size); |
2496 | 0 | } |
2497 | 0 | ASSERT(1 == i4_dummy); |
2498 | 0 | } |
2499 | | |
2500 | 0 | if(i4_unfill_check == 1) |
2501 | 0 | { |
2502 | 0 | isvc_fill_non_avail_pixel(ps_lyr_ctxt, pu1_refarray_1, pu1_refarray_2, i4_refarray_stride, |
2503 | 0 | i4_chroma_flag, u1_map_buf); |
2504 | 0 | } |
2505 | 0 | } |
2506 | | |
2507 | | /*****************************************************************************/ |
2508 | | /* */ |
2509 | | /* Function Name : isvc_interpolate_base_luma_dyadic */ |
2510 | | /* */ |
2511 | | /* Description : This function takes the reference array buffer & performs*/ |
2512 | | /* intra resampling for dyadic scaling ratios */ |
2513 | | /* Inputs : pu1_inp_buf : ptr to the 12x12 reference sample buffer */ |
2514 | | /* pi2_tmp_filt_buf : ptr to the 12x16 buffer to hold the */ |
2515 | | /* vertically interpolated data */ |
2516 | | /* pu1_out_buf : output buffer pointer */ |
2517 | | /* i4_out_stride : output buffer stride */ |
2518 | | /* Globals : none */ |
2519 | | /* Processing : it does the interpolation in vertical direction followed */ |
2520 | | /* by horizontal direction */ |
2521 | | /* Outputs : resampled pixels */ |
2522 | | /* Returns : none */ |
2523 | | /* */ |
2524 | | /* Issues : none */ |
2525 | | /* */ |
2526 | | /* Revision History: */ |
2527 | | /* */ |
2528 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
2529 | | /* 03 12 2010 Nithya creation */ |
2530 | | /* */ |
2531 | | /*****************************************************************************/ |
2532 | | void isvc_interpolate_base_luma_dyadic(UWORD8 *pu1_inp_buf, WORD16 *pi2_tmp_filt_buf, |
2533 | | UWORD8 *pu1_out_buf, WORD32 i4_out_stride) |
2534 | 3.94M | { |
2535 | 3.94M | WORD32 i4_x, i4_y; |
2536 | 3.94M | WORD32 i4_coeff_0, i4_coeff_1, i4_coeff_2, i4_coeff_3; |
2537 | 3.94M | WORD32 i4_samp_0, i4_samp_1, i4_samp_2, i4_samp_3; |
2538 | 3.94M | WORD32 i4_rslt_1, i4_rslt_2; |
2539 | 3.94M | WORD32 i4_filt_stride, i4_src_stride; |
2540 | 3.94M | UWORD8 *pu1_inp, *pu1_out; |
2541 | 3.94M | WORD16 *pi2_tmp; |
2542 | | |
2543 | | /* Filter coefficient values for phase 4 */ |
2544 | 3.94M | i4_coeff_0 = -3; |
2545 | 3.94M | i4_coeff_1 = 28; |
2546 | 3.94M | i4_coeff_2 = 8; |
2547 | 3.94M | i4_coeff_3 = -1; |
2548 | | |
2549 | 3.94M | i4_filt_stride = 12; |
2550 | 3.94M | i4_src_stride = DYADIC_REF_W_Y; |
2551 | | |
2552 | 3.94M | pu1_inp = pu1_inp_buf; |
2553 | 3.94M | pi2_tmp = pi2_tmp_filt_buf; |
2554 | 3.94M | pu1_out = pu1_out_buf; |
2555 | | |
2556 | | /* Vertical interpolation */ |
2557 | 50.5M | for(i4_x = 0; i4_x < 12; i4_x++) |
2558 | 46.6M | { |
2559 | | /* y = 0, y_phase = 12 */ |
2560 | 46.6M | i4_samp_0 = pu1_inp[i4_x]; |
2561 | 46.6M | pu1_inp += i4_src_stride; |
2562 | 46.6M | i4_samp_1 = pu1_inp[i4_x]; |
2563 | 46.6M | pu1_inp += i4_src_stride; |
2564 | 46.6M | i4_samp_2 = pu1_inp[i4_x]; |
2565 | 46.6M | pu1_inp += i4_src_stride; |
2566 | 46.6M | i4_samp_3 = pu1_inp[i4_x]; |
2567 | 46.6M | pu1_inp += i4_src_stride; |
2568 | | |
2569 | | /* since y_phase 12 for y = 0 */ |
2570 | 46.6M | i4_rslt_1 = i4_samp_0 * i4_coeff_3; |
2571 | 46.6M | i4_rslt_1 += i4_samp_1 * i4_coeff_2; |
2572 | 46.6M | i4_rslt_1 += i4_samp_2 * i4_coeff_1; |
2573 | 46.6M | i4_rslt_1 += i4_samp_3 * i4_coeff_0; |
2574 | | |
2575 | 46.6M | pi2_tmp[i4_x] = i4_rslt_1; |
2576 | 46.6M | pi2_tmp += i4_filt_stride; |
2577 | | |
2578 | 372M | for(i4_y = 1; i4_y < 15; i4_y += 2) |
2579 | 325M | { |
2580 | 325M | i4_samp_0 = i4_samp_1; |
2581 | 325M | i4_samp_1 = i4_samp_2; |
2582 | 325M | i4_samp_2 = i4_samp_3; |
2583 | 325M | i4_samp_3 = pu1_inp[i4_x]; |
2584 | | |
2585 | | /* y_phase is 4 for odd values of y */ |
2586 | | /* and 12 for even values of y */ |
2587 | 325M | i4_rslt_1 = i4_samp_0 * i4_coeff_0; |
2588 | 325M | i4_rslt_1 += i4_samp_1 * i4_coeff_1; |
2589 | 325M | i4_rslt_1 += i4_samp_2 * i4_coeff_2; |
2590 | 325M | i4_rslt_1 += i4_samp_3 * i4_coeff_3; |
2591 | | |
2592 | 325M | i4_rslt_2 = i4_samp_0 * i4_coeff_3; |
2593 | 325M | i4_rslt_2 += i4_samp_1 * i4_coeff_2; |
2594 | 325M | i4_rslt_2 += i4_samp_2 * i4_coeff_1; |
2595 | 325M | i4_rslt_2 += i4_samp_3 * i4_coeff_0; |
2596 | | |
2597 | | /* Storing the results */ |
2598 | 325M | pi2_tmp[i4_x] = i4_rslt_1; |
2599 | 325M | pi2_tmp += i4_filt_stride; |
2600 | 325M | pi2_tmp[i4_x] = i4_rslt_2; |
2601 | | |
2602 | | /* Incrementing the pointers */ |
2603 | 325M | pi2_tmp += i4_filt_stride; |
2604 | 325M | pu1_inp += i4_src_stride; |
2605 | 325M | } |
2606 | | |
2607 | | /* y = 15, y_phase = 4 */ |
2608 | 46.6M | i4_samp_0 = i4_samp_1; |
2609 | 46.6M | i4_samp_1 = i4_samp_2; |
2610 | 46.6M | i4_samp_2 = i4_samp_3; |
2611 | 46.6M | i4_samp_3 = pu1_inp[i4_x]; |
2612 | | |
2613 | 46.6M | i4_rslt_1 = i4_samp_0 * i4_coeff_0; |
2614 | 46.6M | i4_rslt_1 += i4_samp_1 * i4_coeff_1; |
2615 | 46.6M | i4_rslt_1 += i4_samp_2 * i4_coeff_2; |
2616 | 46.6M | i4_rslt_1 += i4_samp_3 * i4_coeff_3; |
2617 | | |
2618 | 46.6M | pi2_tmp[i4_x] = i4_rslt_1; |
2619 | 46.6M | pu1_inp = pu1_inp_buf; |
2620 | 46.6M | pi2_tmp = pi2_tmp_filt_buf; |
2621 | 46.6M | } |
2622 | | |
2623 | | /* Horizontal interpolation */ |
2624 | 65.8M | for(i4_y = 0; i4_y < 16; i4_y++) |
2625 | 61.9M | { |
2626 | | /* x = 0, x_phase = 12 */ |
2627 | 61.9M | i4_samp_0 = *pi2_tmp++; |
2628 | 61.9M | i4_samp_1 = *pi2_tmp++; |
2629 | 61.9M | i4_samp_2 = *pi2_tmp++; |
2630 | 61.9M | i4_samp_3 = *pi2_tmp++; |
2631 | | |
2632 | | /* since x_phase 12 for x = 0 */ |
2633 | 61.9M | i4_rslt_1 = i4_samp_0 * i4_coeff_3; |
2634 | 61.9M | i4_rslt_1 += i4_samp_1 * i4_coeff_2; |
2635 | 61.9M | i4_rslt_1 += i4_samp_2 * i4_coeff_1; |
2636 | 61.9M | i4_rslt_1 += i4_samp_3 * i4_coeff_0; |
2637 | 61.9M | i4_rslt_1 += 512; |
2638 | | |
2639 | 61.9M | i4_rslt_1 >>= 10; |
2640 | 61.9M | pu1_out[0] = CLIPUCHAR(i4_rslt_1); |
2641 | | |
2642 | 490M | for(i4_x = 1; i4_x < 15; i4_x += 2) |
2643 | 428M | { |
2644 | 428M | i4_samp_0 = i4_samp_1; |
2645 | 428M | i4_samp_1 = i4_samp_2; |
2646 | 428M | i4_samp_2 = i4_samp_3; |
2647 | 428M | i4_samp_3 = *pi2_tmp++; |
2648 | | |
2649 | | /* x_phase is 4 for odd values of x */ |
2650 | | /* and 12 for even values of x */ |
2651 | 428M | i4_rslt_1 = i4_samp_0 * i4_coeff_0; |
2652 | 428M | i4_rslt_1 += i4_samp_1 * i4_coeff_1; |
2653 | 428M | i4_rslt_1 += i4_samp_2 * i4_coeff_2; |
2654 | 428M | i4_rslt_1 += i4_samp_3 * i4_coeff_3; |
2655 | 428M | i4_rslt_1 += 512; |
2656 | | |
2657 | 428M | i4_rslt_2 = i4_samp_0 * i4_coeff_3; |
2658 | 428M | i4_rslt_2 += i4_samp_1 * i4_coeff_2; |
2659 | 428M | i4_rslt_2 += i4_samp_2 * i4_coeff_1; |
2660 | 428M | i4_rslt_2 += i4_samp_3 * i4_coeff_0; |
2661 | 428M | i4_rslt_2 += 512; |
2662 | | |
2663 | 428M | i4_rslt_1 >>= 10; |
2664 | 428M | i4_rslt_2 >>= 10; |
2665 | | |
2666 | 428M | pu1_out[i4_x] = CLIPUCHAR(i4_rslt_1); |
2667 | 428M | pu1_out[i4_x + 1] = CLIPUCHAR(i4_rslt_2); |
2668 | 428M | } |
2669 | | |
2670 | | /* x = 15 */ |
2671 | 61.9M | i4_samp_0 = i4_samp_1; |
2672 | 61.9M | i4_samp_1 = i4_samp_2; |
2673 | 61.9M | i4_samp_2 = i4_samp_3; |
2674 | 61.9M | i4_samp_3 = *pi2_tmp++; |
2675 | | |
2676 | 61.9M | i4_rslt_1 = i4_samp_0 * i4_coeff_0; |
2677 | 61.9M | i4_rslt_1 += i4_samp_1 * i4_coeff_1; |
2678 | 61.9M | i4_rslt_1 += i4_samp_2 * i4_coeff_2; |
2679 | 61.9M | i4_rslt_1 += i4_samp_3 * i4_coeff_3; |
2680 | 61.9M | i4_rslt_1 += 512; |
2681 | | |
2682 | 61.9M | i4_rslt_1 >>= 10; |
2683 | 61.9M | pu1_out[i4_x] = CLIPUCHAR(i4_rslt_1); |
2684 | 61.9M | pu1_out += i4_out_stride; |
2685 | 61.9M | } |
2686 | 3.94M | } |
2687 | | |
2688 | | /*****************************************************************************/ |
2689 | | /* */ |
2690 | | /* Function Name : isvc_vert_interpol_chroma_dyadic */ |
2691 | | /* */ |
2692 | | /* Description : This function takes the reference array buffer & performs*/ |
2693 | | /* vertical intra resampling for dyadic scaling ratios for */ |
2694 | | /* chroma for the following ref_lyr_chroma_phase_y_plus1 and*/ |
2695 | | /* chroma_phase_y_plus1: */ |
2696 | | /* ref_lyr cur_lyr */ |
2697 | | /* 0 0 */ |
2698 | | /* 1 0 */ |
2699 | | /* 1 1 */ |
2700 | | /* 1 2 */ |
2701 | | /* 2 1 */ |
2702 | | /* 2 2 */ |
2703 | | /* Inputs : pu1_inp_buf : ptr to the 6x6 reference sample buffer */ |
2704 | | /* pi2_tmp_filt_buf : ptr to the 6x8 buffer to hold the */ |
2705 | | /* vertically interpolated data */ |
2706 | | /* i4_phase_0 : y phase for even values of y */ |
2707 | | /* i4_phase_1 : y phase for odd values of y */ |
2708 | | /* Globals : none */ |
2709 | | /* Processing : it does the interpolation in vertical direction */ |
2710 | | /* Outputs : vertically resampled samples */ |
2711 | | /* Returns : none */ |
2712 | | /* */ |
2713 | | /* Issues : none */ |
2714 | | /* */ |
2715 | | /* Revision History: */ |
2716 | | /* */ |
2717 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
2718 | | /* 06 12 2010 Nithya creation */ |
2719 | | /* */ |
2720 | | /*****************************************************************************/ |
2721 | | void isvc_vert_interpol_chroma_dyadic(UWORD8 *pu1_inp_buf, WORD16 *pi2_tmp_filt_buf, |
2722 | | WORD32 i4_phase_0, WORD32 i4_phase_1) |
2723 | 7.85M | { |
2724 | 7.85M | WORD32 i4_x, i4_y; |
2725 | 7.85M | WORD32 i4_coeff_0, i4_coeff_1, i4_coeff_2, i4_coeff_3; |
2726 | 7.85M | WORD32 i4_samp_0, i4_samp_1; |
2727 | 7.85M | WORD32 i4_rslt_1, i4_rslt_2; |
2728 | 7.85M | WORD32 i4_filt_stride, i4_src_stride; |
2729 | 7.85M | UWORD8 *pu1_inp; |
2730 | 7.85M | WORD16 *pi2_tmp; |
2731 | | |
2732 | 7.85M | i4_coeff_0 = 16 - i4_phase_0; |
2733 | 7.85M | i4_coeff_1 = i4_phase_0; |
2734 | 7.85M | i4_coeff_2 = 16 - i4_phase_1; |
2735 | 7.85M | i4_coeff_3 = i4_phase_1; |
2736 | | |
2737 | 7.85M | pu1_inp = pu1_inp_buf; |
2738 | 7.85M | pi2_tmp = pi2_tmp_filt_buf; |
2739 | 7.85M | i4_filt_stride = 6; |
2740 | 7.85M | i4_src_stride = DYADIC_REF_W_C; |
2741 | | |
2742 | | /* Vertical interpolation */ |
2743 | 54.4M | for(i4_x = 0; i4_x < 6; i4_x++) |
2744 | 46.6M | { |
2745 | | /* y = 0, y_phase = phase_0 */ |
2746 | 46.6M | i4_samp_0 = pu1_inp[i4_x]; |
2747 | 46.6M | pu1_inp += i4_src_stride; |
2748 | 46.6M | i4_samp_1 = pu1_inp[i4_x]; |
2749 | 46.6M | pu1_inp += i4_src_stride; |
2750 | | |
2751 | | /* since y_phase = phase_0 for y = 0 */ |
2752 | 46.6M | i4_rslt_1 = i4_samp_0 * i4_coeff_0; |
2753 | 46.6M | i4_rslt_1 += i4_samp_1 * i4_coeff_1; |
2754 | | |
2755 | 46.6M | pi2_tmp[i4_x] = i4_rslt_1; |
2756 | 46.6M | pi2_tmp += i4_filt_stride; |
2757 | | |
2758 | 186M | for(i4_y = 1; i4_y < 7; i4_y += 2) |
2759 | 139M | { |
2760 | 139M | i4_samp_0 = i4_samp_1; |
2761 | 139M | i4_samp_1 = pu1_inp[i4_x]; |
2762 | | |
2763 | | /* y_phase is phase_1 for odd values of y */ |
2764 | | /* and phase_0 for even values of y */ |
2765 | 139M | i4_rslt_1 = i4_samp_0 * i4_coeff_2; |
2766 | 139M | i4_rslt_1 += i4_samp_1 * i4_coeff_3; |
2767 | | |
2768 | 139M | i4_rslt_2 = i4_samp_0 * i4_coeff_0; |
2769 | 139M | i4_rslt_2 += i4_samp_1 * i4_coeff_1; |
2770 | | |
2771 | 139M | pi2_tmp[i4_x] = i4_rslt_1; |
2772 | 139M | pi2_tmp += i4_filt_stride; |
2773 | 139M | pi2_tmp[i4_x] = i4_rslt_2; |
2774 | 139M | pi2_tmp += i4_filt_stride; |
2775 | 139M | pu1_inp += i4_src_stride; |
2776 | 139M | } |
2777 | | |
2778 | | /* y = 7, y_phase = phase_1 */ |
2779 | 46.6M | i4_samp_0 = i4_samp_1; |
2780 | 46.6M | i4_samp_1 = pu1_inp[i4_x]; |
2781 | | |
2782 | 46.6M | i4_rslt_1 = i4_samp_0 * i4_coeff_2; |
2783 | 46.6M | i4_rslt_1 += i4_samp_1 * i4_coeff_3; |
2784 | | |
2785 | 46.6M | pi2_tmp[i4_x] = i4_rslt_1; |
2786 | | |
2787 | 46.6M | pu1_inp = pu1_inp_buf; |
2788 | 46.6M | pi2_tmp = pi2_tmp_filt_buf; |
2789 | 46.6M | } |
2790 | 7.85M | } |
2791 | | |
2792 | | /*****************************************************************************/ |
2793 | | /* */ |
2794 | | /* Function Name : isvc_horz_interpol_chroma_dyadic */ |
2795 | | /* */ |
2796 | | /* Description : This function takes the reference array buffer & performs*/ |
2797 | | /* horizontal intra resampling for dyadic scaling ratios for*/ |
2798 | | /* chroma with following ref_lyr_chroma_phase_x_plus1_flag */ |
2799 | | /* and chroma_phase_x_plus1_flag: */ |
2800 | | /* ref_lyr cur_lyr */ |
2801 | | /* 0 0 */ |
2802 | | /* 1 0 */ |
2803 | | /* 1 1 */ |
2804 | | /* Inputs : pi2_tmp_filt_buf : ptr to the 6x8 buffer containing the */ |
2805 | | /* vertically interpolated data */ |
2806 | | /* pu1_out_buf : pointer to the output buffer */ |
2807 | | /* i4_out_stride : output buffer stride */ |
2808 | | /* i4_phase_0 : x phase for even values of x */ |
2809 | | /* i4_phase_1 : x phase for odd values of x */ |
2810 | | /* Globals : none */ |
2811 | | /* Processing : it does the interpolation in vertical direction */ |
2812 | | /* Outputs : resampled samples */ |
2813 | | /* Returns : none */ |
2814 | | /* */ |
2815 | | /* Issues : none */ |
2816 | | /* */ |
2817 | | /* Revision History: */ |
2818 | | /* */ |
2819 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
2820 | | /* 06 12 2010 Nithya creation */ |
2821 | | /* */ |
2822 | | /*****************************************************************************/ |
2823 | | void isvc_horz_interpol_chroma_dyadic(WORD16 *pi2_tmp_filt_buf, UWORD8 *pu1_out_buf, |
2824 | | WORD32 i4_out_stride, WORD32 i4_phase_0, WORD32 i4_phase_1) |
2825 | 7.78M | { |
2826 | 7.78M | WORD32 i4_x, i4_y; |
2827 | 7.78M | WORD32 i4_coeff_0, i4_coeff_1, i4_coeff_2, i4_coeff_3; |
2828 | 7.78M | WORD32 i4_samp_0, i4_samp_1; |
2829 | 7.78M | WORD32 i4_rslt_1, i4_rslt_2; |
2830 | 7.78M | WORD32 i4_dst_stride; |
2831 | 7.78M | UWORD8 *pu1_out; |
2832 | 7.78M | WORD16 *pi2_tmp; |
2833 | | |
2834 | 7.78M | i4_coeff_0 = 16 - i4_phase_0; |
2835 | 7.78M | i4_coeff_1 = i4_phase_0; |
2836 | 7.78M | i4_coeff_2 = 16 - i4_phase_1; |
2837 | 7.78M | i4_coeff_3 = i4_phase_1; |
2838 | | |
2839 | 7.78M | pu1_out = pu1_out_buf; |
2840 | 7.78M | pi2_tmp = pi2_tmp_filt_buf; |
2841 | 7.78M | i4_dst_stride = i4_out_stride; |
2842 | | |
2843 | | /* Horizontal interpolation */ |
2844 | 69.9M | for(i4_y = 0; i4_y < 8; i4_y++) |
2845 | 62.1M | { |
2846 | | /* x = 0, x_phase = phase_0 */ |
2847 | 62.1M | i4_samp_0 = *pi2_tmp++; |
2848 | 62.1M | i4_samp_1 = *pi2_tmp++; |
2849 | | |
2850 | | /* since x_phase = phase_0 for x = 0 */ |
2851 | 62.1M | i4_rslt_1 = i4_samp_0 * i4_coeff_0; |
2852 | 62.1M | i4_rslt_1 += i4_samp_1 * i4_coeff_1; |
2853 | | |
2854 | | /* Round to 8-bit value */ |
2855 | 62.1M | i4_rslt_1 += 128; |
2856 | 62.1M | i4_rslt_1 >>= 8; |
2857 | | |
2858 | 62.1M | pu1_out[0] = i4_rslt_1; |
2859 | | |
2860 | 248M | for(i4_x = 1; i4_x < 7; i4_x += 2) |
2861 | 186M | { |
2862 | 186M | i4_samp_0 = i4_samp_1; |
2863 | 186M | i4_samp_1 = *pi2_tmp++; |
2864 | | |
2865 | | /* x_phase is phase_1 for odd values of x */ |
2866 | | /* and phase_0 for even values of x */ |
2867 | 186M | i4_rslt_1 = i4_samp_0 * i4_coeff_2; |
2868 | 186M | i4_rslt_1 += i4_samp_1 * i4_coeff_3; |
2869 | | |
2870 | 186M | i4_rslt_2 = i4_samp_0 * i4_coeff_0; |
2871 | 186M | i4_rslt_2 += i4_samp_1 * i4_coeff_1; |
2872 | | |
2873 | | /* Rounding to 8-bit values */ |
2874 | 186M | i4_rslt_1 += 128; |
2875 | 186M | i4_rslt_1 >>= 8; |
2876 | 186M | i4_rslt_2 += 128; |
2877 | 186M | i4_rslt_2 >>= 8; |
2878 | | |
2879 | 186M | pu1_out[2 * i4_x] = i4_rslt_1; |
2880 | 186M | pu1_out[2 * (i4_x + 1)] = i4_rslt_2; |
2881 | 186M | } |
2882 | | |
2883 | | /* y = 7, y_phase = phase_1 */ |
2884 | 62.1M | i4_samp_0 = i4_samp_1; |
2885 | 62.1M | i4_samp_1 = *pi2_tmp++; |
2886 | | |
2887 | | /* since x_phase = phase_1 for x = 7 */ |
2888 | 62.1M | i4_rslt_1 = i4_samp_0 * i4_coeff_2; |
2889 | 62.1M | i4_rslt_1 += i4_samp_1 * i4_coeff_3; |
2890 | | |
2891 | | /* Round to 8-bit value */ |
2892 | 62.1M | i4_rslt_1 += 128; |
2893 | 62.1M | i4_rslt_1 >>= 8; |
2894 | | |
2895 | 62.1M | pu1_out[2 * 7] = i4_rslt_1; |
2896 | 62.1M | pu1_out += i4_dst_stride; |
2897 | 62.1M | } |
2898 | 7.78M | } |
2899 | | |
2900 | | static void isvc_interpolate_intra_base(void *pv_intra_samp_ctxt, UWORD8 *pu1_out, |
2901 | | WORD32 i4_out_stride, WORD32 i4_refarray_wd, |
2902 | | WORD32 i4_chroma_flag, WORD32 i4_refarray_flag) |
2903 | 0 | { |
2904 | 0 | intra_sampling_ctxt_t *ps_ctxt; |
2905 | 0 | intra_samp_lyr_ctxt *ps_lyr_ctxt; |
2906 | 0 | WORD32 i4_x, i4_y; |
2907 | 0 | UWORD8 *pu1_refarray; |
2908 | 0 | coordinates_t *ps_phase; |
2909 | |
|
2910 | 0 | WORD32 i4_temp_array_ht; |
2911 | 0 | WORD32 *pi4_interp_buff; |
2912 | 0 | WORD32 *pi4_interp_buff_temp; |
2913 | |
|
2914 | 0 | WORD32 i4_mb_wd; |
2915 | 0 | WORD32 i4_mb_ht; |
2916 | |
|
2917 | 0 | WORD32 i4_x_min, i4_x_max; |
2918 | |
|
2919 | 0 | ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt; |
2920 | 0 | ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id]; |
2921 | |
|
2922 | 0 | if(0 == i4_refarray_flag) |
2923 | 0 | { |
2924 | 0 | pu1_refarray = ps_ctxt->pu1_refarray_buffer; |
2925 | 0 | } |
2926 | 0 | else |
2927 | 0 | { |
2928 | 0 | pu1_refarray = ps_ctxt->pu1_refarray_cb; |
2929 | 0 | } |
2930 | |
|
2931 | 0 | i4_mb_wd = MB_SIZE >> i4_chroma_flag; |
2932 | 0 | i4_mb_ht = MB_SIZE >> i4_chroma_flag; |
2933 | |
|
2934 | 0 | i4_x_min = ps_lyr_ctxt->i2_x_min_pos; |
2935 | 0 | i4_x_max = ps_lyr_ctxt->i2_x_max_pos; |
2936 | |
|
2937 | 0 | ps_phase = ps_lyr_ctxt->ps_phase; |
2938 | |
|
2939 | 0 | i4_temp_array_ht = i4_mb_ht; |
2940 | 0 | pi4_interp_buff = ps_ctxt->pi4_temp_interpolation_buffer; |
2941 | 0 | pi4_interp_buff_temp = pi4_interp_buff; |
2942 | |
|
2943 | 0 | for(i4_y = 0; i4_y < i4_temp_array_ht; i4_y++) |
2944 | 0 | { |
2945 | 0 | for(i4_x = (i4_x_min - 1); i4_x <= (i4_x_max + 2); i4_x++) |
2946 | 0 | { |
2947 | 0 | WORD32 i4_y_ref = ps_lyr_ctxt->pi4_ref_array_positions_y[i4_y]; |
2948 | 0 | WORD32 i4_y_phase = |
2949 | 0 | ps_phase[(ps_lyr_ctxt->ps_mb_pos->i4_ordinate * i4_mb_ht + i4_y) % 3].i4_ordinate; |
2950 | 0 | UWORD8 *pu1_refarray_temp = pu1_refarray + i4_x + (i4_y_ref * i4_refarray_wd); |
2951 | |
|
2952 | 0 | if(0 == i4_chroma_flag) |
2953 | 0 | { |
2954 | 0 | *(pi4_interp_buff + i4_x) = |
2955 | 0 | (g_ai1_interp_filter_luma[i4_y_phase]) * |
2956 | 0 | (*(pu1_refarray_temp - i4_refarray_wd)) + |
2957 | |
|
2958 | 0 | (g_ai1_interp_filter_luma[16 + i4_y_phase]) * (*(pu1_refarray_temp)) + |
2959 | |
|
2960 | 0 | (g_ai1_interp_filter_luma[32 + i4_y_phase]) * |
2961 | 0 | (*(pu1_refarray_temp + i4_refarray_wd)) + |
2962 | |
|
2963 | 0 | (g_ai1_interp_filter_luma[48 + i4_y_phase]) * |
2964 | 0 | (*(pu1_refarray_temp + (2 * i4_refarray_wd))); |
2965 | 0 | } |
2966 | 0 | else |
2967 | 0 | { |
2968 | 0 | *(pi4_interp_buff + i4_x) = |
2969 | 0 | (g_au1_interp_filter_chroma[i4_y_phase]) * (*(pu1_refarray_temp)) + |
2970 | 0 | (g_au1_interp_filter_chroma[16 + i4_y_phase]) * |
2971 | 0 | (*(pu1_refarray_temp + i4_refarray_wd)); |
2972 | 0 | } |
2973 | 0 | } |
2974 | |
|
2975 | 0 | pi4_interp_buff = pi4_interp_buff + i4_refarray_wd; |
2976 | 0 | } |
2977 | |
|
2978 | 0 | pi4_interp_buff = pi4_interp_buff_temp; |
2979 | |
|
2980 | 0 | for(i4_y = 0; i4_y < i4_temp_array_ht; i4_y++) |
2981 | 0 | { |
2982 | 0 | for(i4_x = 0; i4_x < i4_mb_wd; i4_x++) |
2983 | 0 | { |
2984 | 0 | WORD32 i4_x_ref = ps_lyr_ctxt->pi4_ref_array_positions_y[i4_x]; |
2985 | 0 | WORD32 i4_x_phase = |
2986 | 0 | ps_phase[(ps_lyr_ctxt->ps_mb_pos->i4_abscissa * MAX_REF_ARR_WD_HT + i4_x) % 3] |
2987 | 0 | .i4_ordinate; |
2988 | |
|
2989 | 0 | pi4_interp_buff_temp = pi4_interp_buff + i4_x_ref; |
2990 | |
|
2991 | 0 | if(0 == i4_chroma_flag) |
2992 | 0 | { |
2993 | 0 | *(pu1_out + i4_x + (i4_y * i4_out_stride)) = CLIPUCHAR( |
2994 | 0 | ((g_ai1_interp_filter_luma[i4_x_phase]) * (*(pi4_interp_buff_temp - 1)) + |
2995 | 0 | (g_ai1_interp_filter_luma[16 + i4_x_phase]) * (*(pi4_interp_buff_temp)) + |
2996 | 0 | (g_ai1_interp_filter_luma[32 + i4_x_phase]) * (*(pi4_interp_buff_temp + 1)) + |
2997 | 0 | (g_ai1_interp_filter_luma[48 + i4_x_phase]) * (*(pi4_interp_buff_temp + 2)) + |
2998 | 0 | 512) >> |
2999 | 0 | 10); |
3000 | 0 | } |
3001 | 0 | else |
3002 | 0 | { |
3003 | 0 | *(pu1_out + (2 * i4_x) + (i4_y * i4_out_stride)) = CLIPUCHAR( |
3004 | 0 | ((g_au1_interp_filter_chroma[i4_x_phase]) * (*(pi4_interp_buff_temp)) + |
3005 | 0 | (g_au1_interp_filter_chroma[16 + i4_x_phase]) * (*(pi4_interp_buff_temp + 1)) + |
3006 | 0 | 512) >> |
3007 | 0 | 10); |
3008 | 0 | } |
3009 | 0 | } |
3010 | |
|
3011 | 0 | pi4_interp_buff = pi4_interp_buff + i4_refarray_wd; |
3012 | 0 | } |
3013 | 0 | } |
3014 | | |
3015 | | /*****************************************************************************/ |
3016 | | /* */ |
3017 | | /* Function Name : isvc_intra_samp_mb_dyadic */ |
3018 | | /* */ |
3019 | | /* Description : MB level function which performs the intra resampling */ |
3020 | | /* of data of an MB (luma and chroma inclusive) for dyadic */ |
3021 | | /* scaling ratios */ |
3022 | | /* */ |
3023 | | /* Inputs : pv_intra_samp_ctxt : intra sampling context */ |
3024 | | /* ps_ref_luma : reference layer luma data buffer desc */ |
3025 | | /* ps_ref_chroma : reference layer chroma data buffer desc */ |
3026 | | /* ps_ref_mb_mode_map : ref layer mb mode map buff desc */ |
3027 | | /* ps_curr_luma : current layer out luma buffer desc */ |
3028 | | /* ps_curr_chroma : current layer out chroma buffer desc */ |
3029 | | /* x,y : current mb coorinate */ |
3030 | | /* Globals : none */ |
3031 | | /* Processing : it calls the reference layer construction followed by */ |
3032 | | /* interpolation function for luma and cb and cr */ |
3033 | | /* Outputs : inter resampled data of current MB */ |
3034 | | /* Returns : none */ |
3035 | | /* */ |
3036 | | /* Issues : none */ |
3037 | | /* */ |
3038 | | /* Revision History: */ |
3039 | | /* */ |
3040 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
3041 | | /* 07 12 2010 Nithya creation */ |
3042 | | /* */ |
3043 | | /*****************************************************************************/ |
3044 | | void isvc_intra_samp_mb_dyadic(void *pv_intra_samp_ctxt, mem_element_t *ps_ref_luma, |
3045 | | mem_element_t *ps_ref_chroma, mem_element_t *ps_ref_mb_mode_map, |
3046 | | mem_element_t *ps_curr_luma, mem_element_t *ps_curr_chroma, |
3047 | | UWORD16 u2_mb_x, UWORD16 u2_mb_y, |
3048 | | WORD32 i4_scaled_ref_layer_left_offset, |
3049 | | WORD32 i4_scaled_ref_layer_top_offset) |
3050 | 5.55M | { |
3051 | 5.55M | UWORD8 *pu1_inp_luma, *pu1_inp_chroma; |
3052 | 5.55M | UWORD8 *pu1_out_luma, *pu1_out_chroma; |
3053 | 5.55M | UWORD8 *pu1_out_cb, *pu1_out_cr; |
3054 | 5.55M | UWORD8 *pu1_refarray_luma, *pu1_refarray_cb, *pu1_refarray_cr; |
3055 | 5.55M | WORD16 *pi2_tmp_filt_buf; |
3056 | 5.55M | WORD32 i4_inp_luma_stride, i4_inp_chroma_stride; |
3057 | 5.55M | WORD32 i4_out_luma_stride, i4_out_chroma_stride; |
3058 | 5.55M | UWORD16 u2_mb_x_ref, u2_mb_y_ref; |
3059 | 5.55M | intra_sampling_ctxt_t *ps_ctxt; |
3060 | 5.55M | intra_samp_lyr_ctxt *ps_lyr_ctxt; |
3061 | 5.55M | WORD32 i4_scaled_mb_x, i4_scaled_mb_y; |
3062 | 5.55M | WORD32 i4_top, i4_left; |
3063 | | |
3064 | 5.55M | ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt; |
3065 | 5.55M | ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id]; |
3066 | | |
3067 | 5.55M | i4_scaled_mb_x = u2_mb_x - (i4_scaled_ref_layer_left_offset >> 4); |
3068 | 5.55M | i4_scaled_mb_y = u2_mb_y - (i4_scaled_ref_layer_top_offset >> 4); |
3069 | | |
3070 | 5.55M | if(i4_scaled_mb_x & 0x1) |
3071 | 2.79M | { |
3072 | 2.79M | i4_left = 1; |
3073 | 2.79M | } |
3074 | 2.76M | else |
3075 | 2.76M | { |
3076 | 2.76M | i4_left = -1; |
3077 | 2.76M | } |
3078 | 5.55M | if(i4_scaled_mb_y & 0x1) |
3079 | 2.79M | { |
3080 | 2.79M | i4_top = 1; |
3081 | 2.79M | } |
3082 | 2.75M | else |
3083 | 2.75M | { |
3084 | 2.75M | i4_top = -1; |
3085 | 2.75M | } |
3086 | | |
3087 | 5.55M | u2_mb_x_ref = (i4_scaled_mb_x >> 1); |
3088 | 5.55M | u2_mb_y_ref = (i4_scaled_mb_y >> 1); |
3089 | | |
3090 | 5.55M | pu1_inp_luma = (UWORD8 *) ps_ref_luma->pv_buffer; |
3091 | 5.55M | pu1_inp_chroma = (UWORD8 *) ps_ref_chroma->pv_buffer; |
3092 | | |
3093 | 5.55M | i4_inp_luma_stride = ps_ref_luma->i4_num_element_stride; |
3094 | 5.55M | i4_inp_chroma_stride = ps_ref_chroma->i4_num_element_stride; |
3095 | | |
3096 | | /* ------- Constructing refSampleArray ----------------------- */ |
3097 | 5.55M | isvc_reflayer_construction_dyadic(pv_intra_samp_ctxt, ps_ref_mb_mode_map, pu1_inp_luma, |
3098 | 5.55M | pu1_inp_chroma, i4_inp_luma_stride, i4_inp_chroma_stride, |
3099 | 5.55M | i4_top, i4_left, u2_mb_x_ref, u2_mb_y_ref); |
3100 | | |
3101 | | /* --------------------------------------------------------------------- */ |
3102 | | /* LUMA INTERPOLATION */ |
3103 | | /* --------------------------------------------------------------------- */ |
3104 | 5.55M | pu1_refarray_luma = ps_ctxt->pu1_refarray_buffer; |
3105 | 5.55M | if(1 == i4_top) |
3106 | 2.80M | { |
3107 | 2.80M | pu1_refarray_luma += (DYADIC_REF_W_Y << 3); |
3108 | 2.80M | } |
3109 | 5.55M | if(1 == i4_left) |
3110 | 2.80M | { |
3111 | 2.80M | pu1_refarray_luma += 8; |
3112 | 2.80M | } |
3113 | 5.55M | pu1_out_luma = (UWORD8 *) ps_curr_luma->pv_buffer; |
3114 | 5.55M | i4_out_luma_stride = ps_curr_luma->i4_num_element_stride; |
3115 | 5.55M | pi2_tmp_filt_buf = (WORD16 *) ps_ctxt->pi4_temp_interpolation_buffer; |
3116 | | |
3117 | 5.55M | ps_lyr_ctxt->pf_interpolate_luma(pu1_refarray_luma, pi2_tmp_filt_buf, pu1_out_luma, |
3118 | 5.55M | i4_out_luma_stride); |
3119 | | |
3120 | | /* --------------------------------------------------------------------- */ |
3121 | | /* CHROMA INTERPOLATION */ |
3122 | | /* --------------------------------------------------------------------- */ |
3123 | 5.55M | pu1_out_chroma = (UWORD8 *) ps_curr_chroma->pv_buffer; |
3124 | 5.55M | i4_out_chroma_stride = ps_curr_chroma->i4_num_element_stride; |
3125 | | |
3126 | | /* CB */ |
3127 | 5.55M | pu1_out_cb = pu1_out_chroma; |
3128 | 5.55M | pu1_refarray_cb = ps_ctxt->pu1_refarray_cb; |
3129 | | |
3130 | 5.55M | if(1 == i4_top) |
3131 | 2.80M | { |
3132 | 2.80M | pu1_refarray_cb += (DYADIC_REF_W_C << 2); |
3133 | 2.80M | } |
3134 | 5.55M | if(1 == i4_left) |
3135 | 2.79M | { |
3136 | 2.79M | pu1_refarray_cb += 4; |
3137 | 2.79M | } |
3138 | | |
3139 | | /* Vertical interpolation */ |
3140 | 5.55M | ps_lyr_ctxt->pf_vert_interpol_chroma(pu1_refarray_cb, pi2_tmp_filt_buf, |
3141 | 5.55M | ps_lyr_ctxt->i4_y_phase_0, ps_lyr_ctxt->i4_y_phase_1); |
3142 | | |
3143 | | /* Horizontal interpolation */ |
3144 | 5.55M | ps_lyr_ctxt->pf_horz_interpol_chroma(pi2_tmp_filt_buf, pu1_out_cb, i4_out_chroma_stride, |
3145 | 5.55M | ps_lyr_ctxt->i4_x_phase_0, ps_lyr_ctxt->i4_x_phase_1); |
3146 | | |
3147 | | /* CR */ |
3148 | 5.55M | pu1_out_cr = pu1_out_chroma + 1; |
3149 | 5.55M | pu1_refarray_cr = ps_ctxt->pu1_refarray_cr; |
3150 | | |
3151 | 5.55M | if(1 == i4_top) |
3152 | 2.80M | { |
3153 | 2.80M | pu1_refarray_cr += (DYADIC_REF_W_C << 2); |
3154 | 2.80M | } |
3155 | 5.55M | if(1 == i4_left) |
3156 | 2.79M | { |
3157 | 2.79M | pu1_refarray_cr += 4; |
3158 | 2.79M | } |
3159 | | |
3160 | | /* Vertical interpolation */ |
3161 | 5.55M | ps_lyr_ctxt->pf_vert_interpol_chroma(pu1_refarray_cr, pi2_tmp_filt_buf, |
3162 | 5.55M | ps_lyr_ctxt->i4_y_phase_0, ps_lyr_ctxt->i4_y_phase_1); |
3163 | | |
3164 | | /* Horizontal interpolation */ |
3165 | 5.55M | ps_lyr_ctxt->pf_horz_interpol_chroma(pi2_tmp_filt_buf, pu1_out_cr, i4_out_chroma_stride, |
3166 | 5.55M | ps_lyr_ctxt->i4_x_phase_0, ps_lyr_ctxt->i4_x_phase_1); |
3167 | 5.55M | } |
3168 | | |
3169 | | /*****************************************************************************/ |
3170 | | /* */ |
3171 | | /* Function Name : isvc_intra_samp_mb */ |
3172 | | /* */ |
3173 | | /* Description : MB level function which performs the intra resampling */ |
3174 | | /* of data of an MB (luma and chroma inclusive) */ |
3175 | | /* */ |
3176 | | /* Inputs : pv_intra_samp_ctxt : intra sampling context */ |
3177 | | /* ps_ref_luma : reference layer luma data buffer desc */ |
3178 | | /* ps_ref_chroma : reference layer chroma data buffer desc */ |
3179 | | /* ps_ref_mb_mode_map : ref layer mb mode map buff desc */ |
3180 | | /* ps_curr_luma : current layer out luma buffer desc */ |
3181 | | /* ps_curr_chroma : current layer out chroma buffer desc */ |
3182 | | /* x,y : current mb coorinate */ |
3183 | | /* Globals : none */ |
3184 | | /* Processing : it calls the reference layer construction followed by */ |
3185 | | /* interpolation function for luma and cb and cr */ |
3186 | | /* Outputs : inter resampled data of current MB */ |
3187 | | /* Returns : none */ |
3188 | | /* */ |
3189 | | /* Issues : none */ |
3190 | | /* */ |
3191 | | /* Revision History: */ |
3192 | | /* */ |
3193 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
3194 | | /* 07 12 2010 Nithya creation */ |
3195 | | /* */ |
3196 | | /*****************************************************************************/ |
3197 | | void isvc_intra_samp_mb(void *pv_intra_samp_ctxt_luma, void *pv_intra_samp_ctxt_chroma, |
3198 | | mem_element_t *ps_ref_luma, mem_element_t *ps_ref_chroma, |
3199 | | mem_element_t *ps_ref_mb_mode_map, mem_element_t *ps_curr_luma, |
3200 | | mem_element_t *ps_curr_chroma) |
3201 | 0 | { |
3202 | 0 | UWORD8 *pu1_inp_luma, *pu1_inp_chroma; |
3203 | 0 | UWORD8 *pu1_out_luma, *pu1_out_chroma; |
3204 | 0 | UWORD8 *pu1_out_cb, *pu1_out_cr; |
3205 | 0 | WORD32 i4_inp_luma_stride, i4_inp_chroma_stride; |
3206 | 0 | WORD32 i4_out_luma_stride, i4_out_chroma_stride; |
3207 | 0 | WORD32 i4_chroma_flag, i4_refarray_stride; |
3208 | |
|
3209 | 0 | intra_sampling_ctxt_t *ps_ctxt_luma; |
3210 | 0 | intra_sampling_ctxt_t *ps_ctxt_chroma; |
3211 | |
|
3212 | 0 | ps_ctxt_luma = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt_luma; |
3213 | 0 | ps_ctxt_chroma = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt_chroma; |
3214 | |
|
3215 | 0 | i4_refarray_stride = ps_ctxt_luma->i4_refarray_stride; |
3216 | |
|
3217 | 0 | pu1_inp_luma = (UWORD8 *) ps_ref_luma->pv_buffer; |
3218 | 0 | pu1_inp_chroma = (UWORD8 *) ps_ref_chroma->pv_buffer; |
3219 | |
|
3220 | 0 | i4_inp_luma_stride = ps_ref_luma->i4_num_element_stride; |
3221 | 0 | i4_inp_chroma_stride = ps_ref_chroma->i4_num_element_stride; |
3222 | |
|
3223 | 0 | pu1_out_luma = (UWORD8 *) ps_curr_luma->pv_buffer; |
3224 | 0 | i4_out_luma_stride = ps_curr_luma->i4_num_element_stride; |
3225 | |
|
3226 | 0 | i4_chroma_flag = 0; |
3227 | | |
3228 | | /* ------- Constructing refSampleArray ----------------------- */ |
3229 | 0 | isvc_reflayer_construction(pv_intra_samp_ctxt_luma, pu1_inp_luma, i4_inp_luma_stride, |
3230 | 0 | i4_refarray_stride, ps_ref_mb_mode_map, i4_chroma_flag); |
3231 | | |
3232 | | /* ---- Interpolation process for Intra_Base prediction ------ */ |
3233 | 0 | isvc_interpolate_intra_base(pv_intra_samp_ctxt_luma, pu1_out_luma, i4_out_luma_stride, |
3234 | 0 | i4_refarray_stride, i4_chroma_flag, 0); |
3235 | |
|
3236 | 0 | pu1_out_chroma = (UWORD8 *) ps_curr_chroma->pv_buffer; |
3237 | 0 | i4_out_chroma_stride = ps_curr_chroma->i4_num_element_stride; |
3238 | |
|
3239 | 0 | pu1_out_cb = pu1_out_chroma; |
3240 | 0 | pu1_out_cr = pu1_out_cb + 1; |
3241 | |
|
3242 | 0 | i4_refarray_stride = ps_ctxt_chroma->i4_refarray_stride; |
3243 | |
|
3244 | 0 | i4_chroma_flag = 1; |
3245 | | |
3246 | | /* ------- Constructing refSampleArray ----------------------- */ |
3247 | 0 | isvc_reflayer_construction(pv_intra_samp_ctxt_chroma, pu1_inp_chroma, i4_inp_chroma_stride, |
3248 | 0 | i4_refarray_stride, ps_ref_mb_mode_map, i4_chroma_flag); |
3249 | | |
3250 | | /* ---- Cb Interpolation process for Intra_Base prediction ------ */ |
3251 | 0 | isvc_interpolate_intra_base(pv_intra_samp_ctxt_chroma, pu1_out_cb, i4_out_chroma_stride, |
3252 | 0 | i4_refarray_stride, i4_chroma_flag, 0); |
3253 | | |
3254 | | /* ---- Cr Interpolation process for Intra_Base prediction ------ */ |
3255 | 0 | isvc_interpolate_intra_base(pv_intra_samp_ctxt_chroma, pu1_out_cr, i4_out_chroma_stride, |
3256 | 0 | i4_refarray_stride, i4_chroma_flag, 1); |
3257 | 0 | } |