欢迎来到天天文库
浏览记录
ID:37447407
大小:313.50 KB
页数:14页
时间:2019-05-24
《C语言实现DCT变换编码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Contents1.DCT变换编码C语言2.MPEG4中逆DCT变换3.DCT变换探究4.快速DCT变换DCT变换编码C语言#include#include#include#include#definePI3.1415926#defineCLK_TCKCLOCKS_PER_SECintN;voidDCT(double*f,double*F){ intn,m,x; double*dTemp=newdouble[N*N];//中间矩阵 double*coff=newdouble[N*N];//变换系数 coff[0]=1
2、/sqrt(N); for(m=1;m3、x4、N*N); memset(F,0,sizeof(double)*N*N); //一维变换 for(x=0;x5、elete[]coff;}intmain(){ clock_tstart,end; start=clock(); inti; longL; printf("变换维数:"); scanf("%d",&N); double*f=newdouble[N*N];//初始矩阵 double*F=newdouble[N*N];//变换后输出矩阵 memset(F,0,sizeof(double)*N*N);//初始化为0 for(i=0;i6、数:"); scanf("%d",&L);//输出初始矩阵 printf("变换前:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } for(i=0;i7、 printf("反变换后:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } //printf(""); delete[]f; delete[]F; end=clock(); printf("耗时:%f",(double)(end-start)/CLK_TCK); return0; }==============
3、x4、N*N); memset(F,0,sizeof(double)*N*N); //一维变换 for(x=0;x5、elete[]coff;}intmain(){ clock_tstart,end; start=clock(); inti; longL; printf("变换维数:"); scanf("%d",&N); double*f=newdouble[N*N];//初始矩阵 double*F=newdouble[N*N];//变换后输出矩阵 memset(F,0,sizeof(double)*N*N);//初始化为0 for(i=0;i6、数:"); scanf("%d",&L);//输出初始矩阵 printf("变换前:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } for(i=0;i7、 printf("反变换后:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } //printf(""); delete[]f; delete[]F; end=clock(); printf("耗时:%f",(double)(end-start)/CLK_TCK); return0; }==============
4、N*N); memset(F,0,sizeof(double)*N*N); //一维变换 for(x=0;x5、elete[]coff;}intmain(){ clock_tstart,end; start=clock(); inti; longL; printf("变换维数:"); scanf("%d",&N); double*f=newdouble[N*N];//初始矩阵 double*F=newdouble[N*N];//变换后输出矩阵 memset(F,0,sizeof(double)*N*N);//初始化为0 for(i=0;i6、数:"); scanf("%d",&L);//输出初始矩阵 printf("变换前:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } for(i=0;i7、 printf("反变换后:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } //printf(""); delete[]f; delete[]F; end=clock(); printf("耗时:%f",(double)(end-start)/CLK_TCK); return0; }==============
5、elete[]coff;}intmain(){ clock_tstart,end; start=clock(); inti; longL; printf("变换维数:"); scanf("%d",&N); double*f=newdouble[N*N];//初始矩阵 double*F=newdouble[N*N];//变换后输出矩阵 memset(F,0,sizeof(double)*N*N);//初始化为0 for(i=0;i6、数:"); scanf("%d",&L);//输出初始矩阵 printf("变换前:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } for(i=0;i7、 printf("反变换后:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } //printf(""); delete[]f; delete[]F; end=clock(); printf("耗时:%f",(double)(end-start)/CLK_TCK); return0; }==============
6、数:"); scanf("%d",&L);//输出初始矩阵 printf("变换前:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } for(i=0;i7、 printf("反变换后:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } //printf(""); delete[]f; delete[]F; end=clock(); printf("耗时:%f",(double)(end-start)/CLK_TCK); return0; }==============
7、 printf("反变换后:"); for(i=1;i<=N*N;i++) { printf("%ft",f[i-1]); if(i%N==0) printf(""); } //printf(""); delete[]f; delete[]F; end=clock(); printf("耗时:%f",(double)(end-start)/CLK_TCK); return0; }==============
此文档下载收益归作者所有