Question: Please Please Please help me with this assignment!!! Needs to be coded in C or C++ . Thank you!!!!!!! n this assignment, you will use

Please Please Please help me with this assignment!!! Needs to be coded in C or C++ . Thank you!!!!!!!

Please Please Please help me with this assignment!!! Needs to be coded

n this assignment, you will use POSIX Pthreads to parallelize the Floyd-Steinberg Image Dithering algorithm. The Floyd-Steinberg lgorithm is a technique for displaying continuous-tone digital images on devices that have limited color tone) ranges. A typical application for this technique is the printing of an 8-bit grayscale image on a black-and-white printer. In this case the printer must simulate multiple shades of gray by using an approximation technique. Figure 1 shows an example of this technique THE SEQUENTIAL ALGORITHM The algorithm is a simple three step process, applied to all pixels in the image: l. Determine the output value for a pixel given the input value of the current pixel Uses quantization or thresholding Example: 8-bit grayscale image that is displayed on a 1-bit output device, a input values in the range [0,127] are to be displayed as a 0, and all values in the range [128,255] as a 1. Consider a pixel value of 168, since it is larger than the threshold (128), the output value will be 1 2. Compute the error between what should be displayed and what is actually displayed. To compute the error, the algorithm normalizes the output first, so it is in the same scale as the input value. output pixel must be 0 ifthe input is 0, and 1 if the input pixel is 255 In this case, the display error is the difference between the actual value that should have been displayed (168 in our example) and he output value (255), which is -87 3. Distribute the error value on a fractional basis to the neighboring pixels in the region (see Figure 2 7/16ths of the error is added to the input pixel to the right of the current pixe 5/16ths of the error is added to the pixel in the next row The remaining errors are propagated in a similar fashion Your tests should be I. REQUIREMENTS performed for different input using POSIX Pthreads. Your program should accept two comman mage si and a varying Implement the parallel strategy above number of threads. You arguments, the name of the image to be processed, and the (maximum) number t of threads to be will then open the input image and create the specified number of threads. Since there will should a least try created. You generally be more rows in the image than t threads, each thread iwill process rows 1,2,3,4,5,6,7, and 8 threads Calculate the speed-up values for the different numbers of You can implement this without the need for explicit synchronization primitives. It is sufficient to create threads. The speedup is an array of tmax integers, one for each thread. Each pixel of the image is assigned a unique integer value, starting with the values of the first row, then the second row, etc. Each thread will write the defined as the sequential number of the current pixel into its element ofthe array. Thread ican then determine whether a pixel execution time divided by the can be processed by evaluating the value in thread 1's array element. parallel execution time of your algorithm. Also compute the efficiency which is defined as the speed-up divided by the total number of logical processors. Create a document that summarizes your results. It should contain plots to visualizethe speed-up and efficiency results, and a comparison of the impact of false sharing on your algorithm performance. void error diffusion unsigned int width unsigned int height unsigned short Input Image unsigned short "Output laage for (unsigned int i 01 height for (unsigned int j 01 j width Compute the value of the output pixel if (Input Image output image else output Imagelijtij Compute the error value int err Input Image 255 output Image Distribute the error Input Image Iij 7/161 Input Image li lj lj err 3/161 Input Image Ii 11 5/161 Input Image li err 1/161 n this assignment, you will use POSIX Pthreads to parallelize the Floyd-Steinberg Image Dithering algorithm. The Floyd-Steinberg lgorithm is a technique for displaying continuous-tone digital images on devices that have limited color tone) ranges. A typical application for this technique is the printing of an 8-bit grayscale image on a black-and-white printer. In this case the printer must simulate multiple shades of gray by using an approximation technique. Figure 1 shows an example of this technique THE SEQUENTIAL ALGORITHM The algorithm is a simple three step process, applied to all pixels in the image: l. Determine the output value for a pixel given the input value of the current pixel Uses quantization or thresholding Example: 8-bit grayscale image that is displayed on a 1-bit output device, a input values in the range [0,127] are to be displayed as a 0, and all values in the range [128,255] as a 1. Consider a pixel value of 168, since it is larger than the threshold (128), the output value will be 1 2. Compute the error between what should be displayed and what is actually displayed. To compute the error, the algorithm normalizes the output first, so it is in the same scale as the input value. output pixel must be 0 ifthe input is 0, and 1 if the input pixel is 255 In this case, the display error is the difference between the actual value that should have been displayed (168 in our example) and he output value (255), which is -87 3. Distribute the error value on a fractional basis to the neighboring pixels in the region (see Figure 2 7/16ths of the error is added to the input pixel to the right of the current pixe 5/16ths of the error is added to the pixel in the next row The remaining errors are propagated in a similar fashion Your tests should be I. REQUIREMENTS performed for different input using POSIX Pthreads. Your program should accept two comman mage si and a varying Implement the parallel strategy above number of threads. You arguments, the name of the image to be processed, and the (maximum) number t of threads to be will then open the input image and create the specified number of threads. Since there will should a least try created. You generally be more rows in the image than t threads, each thread iwill process rows 1,2,3,4,5,6,7, and 8 threads Calculate the speed-up values for the different numbers of You can implement this without the need for explicit synchronization primitives. It is sufficient to create threads. The speedup is an array of tmax integers, one for each thread. Each pixel of the image is assigned a unique integer value, starting with the values of the first row, then the second row, etc. Each thread will write the defined as the sequential number of the current pixel into its element ofthe array. Thread ican then determine whether a pixel execution time divided by the can be processed by evaluating the value in thread 1's array element. parallel execution time of your algorithm. Also compute the efficiency which is defined as the speed-up divided by the total number of logical processors. Create a document that summarizes your results. It should contain plots to visualizethe speed-up and efficiency results, and a comparison of the impact of false sharing on your algorithm performance. void error diffusion unsigned int width unsigned int height unsigned short Input Image unsigned short "Output laage for (unsigned int i 01 height for (unsigned int j 01 j width Compute the value of the output pixel if (Input Image output image else output Imagelijtij Compute the error value int err Input Image 255 output Image Distribute the error Input Image Iij 7/161 Input Image li lj lj err 3/161 Input Image Ii 11 5/161 Input Image li err 1/161

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!