3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file csc_tiled_to_linear_uv.s
20 * @brief SEC_OMX specific define. It support MFC 6.x tiled.
21 * @author ShinWon Lee (shinwon.lee@samsung.com)
28 * Converts tiled data to linear for mfc 6.x tiled
29 * 1. uv of nv12t to y of yuv420s
32 * uv address of yuv420s[out]
35 * uv address of nv12t[in]
38 * real width of yuv420s[in]
40 * @param yuv420_height
41 * real height of yuv420s[in]
46 .global csc_tiled_to_linear_uv_neon
47 .type csc_tiled_to_linear_uv_neon, %function
48 csc_tiled_to_linear_uv_neon:
51 .equ CACHE_LINE_SIZE, 64
52 .equ PRE_LOAD_OFFSET, 6
69 stmfd sp!, {r4-r12,r14} @ backup registers
70 ldr r4, [sp, #40] @ r4 = height
72 bic r9, r3, #0x7 @ aligned_height = height & (~0xF)
73 bic r10, r2, #0xF @ aligned_width = width & (~0xF)
74 add r11, r2, #15 @ tiled_width = ((width + 15) >> 4) << 4
79 LOOP_MAIN_ALIGNED_HEIGHT:
80 mul r8, r11, r5 @ src_offset = tiled_width * i
82 add r8, r1, r8 @ src_offset = y_src + src_offset
83 LOOP_MAIN_ALIGNED_WIDTH:
84 pld [r8, #(CACHE_LINE_SIZE*PRE_LOAD_OFFSET)]
85 vld1.8 {q0, q1}, [r8]!
86 mul r12, r2, r5 @ temp1 = width * i + j;
87 vld1.8 {q2, q3}, [r8]!
89 pld [r8, #(CACHE_LINE_SIZE*PRE_LOAD_OFFSET)]
90 vld1.8 {q4, q5}, [r8]!
91 add r7, r0, r12 @ dst_offset = y_dst + temp1
92 vld1.8 {q6, q7}, [r8]!
100 vst1.8 {q6}, [r7], r2
101 vst1.8 {q7}, [r7], r2
104 blt LOOP_MAIN_ALIGNED_WIDTH
106 MAIN_REMAIN_WIDTH_START:
107 cmp r10, r2 @ if (aligned_width != width) {
108 beq MAIN_REMAIN_WIDTH_END
110 mul r8, r11, r5 @ src_offset = (tiled_width * i) + (j << 3);
111 add r8, r8, r6, lsl #3
112 add r8, r1, r8 @ r8 = y_src + src_offset
114 mul r12, r2, r5 @ temp1 = width * i + j;
116 add r7, r0, r12 @ r7 = y_dst + temp1
117 sub r14, r2, r6 @ r14 = width - j
119 stmfd sp!, {r0-r1} @ backup registers
121 LOOP_MAIN_REMAIN_HEIGHT:
122 mov r0, #0 @ r0 is index in memcpy
123 LOOP_MAIN_REMAIN_WIDTH:
128 blt LOOP_MAIN_REMAIN_WIDTH
137 blt LOOP_MAIN_REMAIN_HEIGHT
138 ldmfd sp!, {r0-r1} @ restore registers
139 MAIN_REMAIN_WIDTH_END:
143 blt LOOP_MAIN_ALIGNED_HEIGHT
146 cmp r9, r3 @ if (aligned_height != height) {
147 beq REMAIN_HEIGHT_END
150 LOOP_REMAIN_HEIGHT_WIDTH16:
151 mul r8, r11, r5 @ src_offset = (tiled_width * i) + (j << 3)
152 add r8, r8, r6, lsl #3
153 add r8, r1, r8 @ src_offset = y_src + src_offset
155 mul r12, r2, r5 @ temp1 = width * i + j;
157 add r7, r0, r12 @ r7 = y_dst + temp1
161 LOOP_REMAIN_HEIGHT_WIDTH16_HEIGHT1:
164 vst1.8 {q0}, [r7], r2
165 vst1.8 {q1}, [r7], r2
169 blt LOOP_REMAIN_HEIGHT_WIDTH16_HEIGHT1
173 blt LOOP_REMAIN_HEIGHT_WIDTH16
175 REMAIN_HEIGHT_REMAIN_WIDTH_START:
177 beq REMAIN_HEIGHT_REMAIN_WIDTH_END
178 mul r8, r11, r5 @ src_offset = (tiled_width * i) + (j << 3)
179 add r8, r8, r6, lsl #3
180 add r8, r1, r8 @ src_offset = y_src + src_offset
182 mul r12, r2, r5 @ temp1 = width * i + j;
184 add r7, r0, r12 @ r7 = y_dst + temp1
186 stmfd sp!, {r0-r1,r3} @ backup registers
189 LOOP_REMAIN_HEIGHT_REMAIN_WIDTH_HEIGHT1:
193 LOOP_REMAIN_HEIGHT_REMAIN_WIDTH_HEIGHT1_WIDTHx:
198 blt LOOP_REMAIN_HEIGHT_REMAIN_WIDTH_HEIGHT1_WIDTHx
207 blt LOOP_REMAIN_HEIGHT_REMAIN_WIDTH_HEIGHT1
208 ldmfd sp!, {r0-r1,r3} @ restore registers
210 REMAIN_HEIGHT_REMAIN_WIDTH_END:
215 ldmfd sp!, {r4-r12,r15} @ restore registers