Question: Need helping getting this assmebly function to work _ _attribute__ ((naked)) void semi_thresholding_hybrid(uint8_t *x, uint32_t size, uint8_t threshold) { __asm volatile ( // x ->
Need helping getting this assmebly function to work
__attribute__ ((naked)) void semi_thresholding_hybrid(uint8_t *x, uint32_t size, uint8_t threshold) { __asm volatile ( // x -> r0, size -> r1, threshold -> r2 "PUSH {r4, r5, r6, lr} \t" // save return address
// loop over the array "MOV r3, #0 \t" // loop counter r3 "LDRB r4, [r0] \t" "MOV r5, #0 \t" // constant used" "loop_gth: CMP r3, r1 \t" // terminate the loop when r3 >= r1 "BGE exit_gth \t" "LDRB r6, [r0] \t" // load array element to r6 "CMP r6, r2 \t" // compare with threshold r2 "BGE else_gth \t" "STRB r5, [r0], #1 \t" // store r5 to its memory location, post increment r0 by 1 "B endif_gth \t" "else_gth: STRB r4, [r0], #1 \t" // store r4 to its memory location, post increment r0 by 1 "endif_gth: ADD r3, r3, #1 \t" // increment loop counter "B loop_gth \t" "exit_gth: POP {r4, r5, r6, pc} \t" // return from function
);
This is the function it is based off of:

3) Semi thresholding Semi thresholding assigns a grayscale value 0 (black) to the background. For a given threshold T, the equation is: f(x, y) = {op black) if p(x,y)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
