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 -> r0,

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 "MOV r4, #0 \t" "MOV r5, #0 \t" // constant used" "loop_hth: CMP r3, r1 \t" // terminate the loop when r3 >= r1 "BGE exit_hth \t" "LDRB r6, [r0] \t" // load array element to r6 "CMP r6, r2 \t" // compare with threshold r2 "BGE else_hth \t" "STRB r5, [r0], #1 \t" // store r5 to its memory location, post increment r0 by 1 "B endif_hth \t" "else_hth: STRB [r0], #1 \t" // store r4 to its memory location, post increment r0 by 1 "endif_hth: ADD r3, r3, #1 \t" // increment loop counter "B loop_gth \t" "exit_hth: POP {r4, r5, r6, pc} \t" // return from function

);

It's based on the function below: Need helping getting this assmebly function to work _attribute__ ((naked)) void semi_thresholding_hybrid(uint8_t

The pseudo code for the histogram equalization is shown below: Initializing_Phase Assume original image is stored in image_org and resultant image in image_equ Let N be the number of pixels for each frame Let L = 256 (number of grayscale levels) Define buffers hist[L], mapped_levels [L] Initialize elements of hist to O calculate_histogram (step 1) For i = 1 - N Temp = current pixel value Increment hist[temp] // counting the number of occurrences of End For each level map_levels (on the fly) (step 2 and 3) For i= 1 - L Update sum = accumulated histogram count mapped_levels[i] = (int) (L-1) *sum/N End For transform_image (step 4) For i = 1 N img_equ[i] = mapped_levels[img_org[i]] End For The pseudo code for the histogram equalization is shown below: Initializing_Phase Assume original image is stored in image_org and resultant image in image_equ Let N be the number of pixels for each frame Let L = 256 (number of grayscale levels) Define buffers hist[L], mapped_levels [L] Initialize elements of hist to O calculate_histogram (step 1) For i = 1 - N Temp = current pixel value Increment hist[temp] // counting the number of occurrences of End For each level map_levels (on the fly) (step 2 and 3) For i= 1 - L Update sum = accumulated histogram count mapped_levels[i] = (int) (L-1) *sum/N End For transform_image (step 4) For i = 1 N img_equ[i] = mapped_levels[img_org[i]] End For

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!