⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rotate.c

📁 卡耐基SSD6全部选择题和练习题解决方法。
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>
#include "defs.h"
#include "cache.h"


/* Here is an our naive implementation */
char rotate_descr[] = "Naive Row-wise Traversal of src";

void rotate(int dim, pixel *src, pixel *dst) {
	int i, j;
	int max,m, n;
	int ratio = 8;
	if(dim == 1024)
		ratio = 4;
	

	max = dim/ratio;
	for(m = 0; m < max ; m ++){
		for(n = 0; n < max ; n ++)
		{
			int xNum = m*ratio;
			int yNum = n*ratio;
			for(i=xNum; i < xNum + ratio; i++) {
				for(j=yNum; j < yNum + ratio; j++) {
					COPY(&dst[PIXEL(dim-1-j,i,dim)], &src[PIXEL(i,j,dim)]);
				}
			}
		}
	}

	return;
}



/* Add additional functions to test here */
void register_rotate_functions() {
	add_rotate_function(&rotate, rotate_descr);
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -