Question: Need help getting this assembly function to work, I am not sure where I am going wrong. __attribute__ ((naked)) void semi_thresholding_hybrid(uint8_t *x, uint32_t size, uint8_t

Need help getting this assembly function to work, I am not sure where I am going wrong.

__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" // loop counter r3 "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:

Need help getting this assembly function to work, I am not sure

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) T (0 (black) if p(x,y)T (0 (black) if p(x,y)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!