[mw_shl_code=c,true]#define ABSDIFF(frame1, frame2)
({
int result = 0;
asm volatile(
"mov %[result], #0
" /* accumulator */
"ldr r4, [%[src], #0]
" /* read data from address + offset*/
"ldr r5, [%[dst], #0]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #4]
" /* read data from address + offset */
"ldr r5, [%[dst], #4]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 1)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 1)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 1 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 1 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 2)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 2)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 2 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 2 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 3)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 3)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 3 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 3 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 4)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 4 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 4 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 5)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 5)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 5 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 5 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 6)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 6)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 6 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 6 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 7)]
" /* read data from address + offset*/
"ldr r5, [%[dst], #(64 * 7)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
"ldr r4, [%[src], #(64 * 7 + 4)]
" /* read data from address + offset */
"ldr r5, [%[dst], #(64 * 7 + 4)]
"
"usada8 %[result], r4, r5, %[result]
" /* difference */
: [result] "+r" (result)
: [src] "r" (frame1), [dst] "r" (frame2)
: "r4", "r5"
);
result;
})[/mw_shl_code]
然后在后边调用:uint32_t temp_dist = ABSDIFF(base1, base2+ii);
出错: error: #29: expected an expression.
temp_dist = ABSDIFF(base1, base2+ii);
请教大神怎么解决
一周热门 更多>