[NO-PARSE]#include <stdio.h>
#define BITS_PER_CLOCK_COEFFICIENT 10
struct pixels
{
unsigned int horizontal;
unsigned int vertical;
};
int main(void)
{
struct pixels px = { 2200, 1125 };
double refresh_rate = 60.0;
unsigned int bits_per_pixel = 8;
fputs("HPx - Horizontal total pixels\n"
"VPx - Vertical total pixels\n"
"R - Refresh rate (Hz)\n"
"BP - Bits/pixel (8/10/12/16)\n\n"
"Enter: <HPx> <VTPx> <R> <BP>\n\t>> ", stdout);
if (scanf(" %u %u %lf %u", &px.horizontal, &px.vertical, &refresh_rate, &bits_per_pixel) != 4)
{
fputs("ERROR: invalid usage\n", stderr);
return 1;
}
putchar('\n');
double color_depth_factor;
unsigned int total_px;
double bandwidth;
total_px = px.horizontal * px.vertical;
printf("Total pixels per frame: %u\n", total_px);
total_px = (unsigned int)(total_px * refresh_rate);
printf("Approx total pixels per second: %u\n", total_px);
color_depth_factor = 1.00 + ((8 - bits_per_pixel) / 2 * 0.20);
printf("Color depth factor: %f\n", color_depth_factor);
bandwidth = total_px * BITS_PER_CLOCK_COEFFICIENT;
printf("Bandwidth per channel: %.2f Gbps ", bandwidth / 10e8);
printf("(%f)\n", bandwidth / 10e8);bandwidth *= 3.0;
printf("Total bandwidth: %.2f Gbps ", bandwidth / 10e8);
printf("(%f)\n", bandwidth / 10e8);
return 0;
}[/NO-PARSE]