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

📄 reconstruct.cpp

📁 可以选择各种压缩方式对读入的图像进行压缩和解压
💻 CPP
字号:
#include "stdafx.h"
#include<iostream>

#include "zigzag.h"
#include "reconstruct.h"

int reconstruct(blstype bls, symbolStreamStruct *stream,  btype (**P)[8][8]) {
//if n!=actual block number, return 1, else return 0

	btype (*F)[8][8];
	F=new btype [bls][8][8];
	*P=F;

	symbolStreamStruct *p=stream;
	unsigned int n=0, sum=0, i, s=0;
	int  x, y;
	initZigZag(8);
	
	while (p->next && n<bls) {
		if (p->e.run>61) {
			printf("Reconstruct: too big run, check algrothim!\n");
			return 0;
		}
		if (p->e.level){
			if (p->e.run)
				for (i=0;i<p->e.run;i++) {
					fastZigZag(s++,x,y);
					F[n][x][y]=0;
				}
			fastZigZag(s++,x,y);
			F[n][x][y]=p->e.level;
			if (s==63) { 
				s=0; 
				n++; 
			}
		}
		else {//EOB
			for (i=s;i<63;i++){
				fastZigZag(i,x,y);
				F[n][x][y]=0;
			}
			s=0; n++;
		}
		p=p->next;
	}

	if (p->next) {
		printf("Reconstruct: too many symbols in stream (more than anticipate)!\n");
		return 0;
	}
	return 1;
}

void diff2dc(btype (*Q)[8][8], short *diff, blstype nn){
	Q[0][0][0]=diff[0];
	for (blstype i=1; i<nn; i++)
		Q[i][0][0]=diff[i]+Q[i-1][0][0];
}

⌨️ 快捷键说明

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