Tag: dct

试图实现dct 8 * 8矩阵的逆

我已经设法计算了一个8 * 8矩阵的dct,我在进行反向操作时遇到了麻烦。 任何人都可以看看这段代码并告诉我现在正在做什么。 我应该得到与以前完全相同的值,但我得到不同的值。 我正在读取来自csv文件的输入并将其放入anther csv文件中。 它的编程顺序为c void idct_func(float inMatrix[8][8]){ double idct, Cu, sum, Cv; int i, j, u, v; float idctMatrix[8][8], greyLevel; FILE * fp = fopen(“mydata.csv”, “r”); FILE * wp = fopen(“idct.csv”, “w”); fprintf(fp, “\n Inverse DCT”); for (i = 0; i < 8; ++i) { for (j = 0; j < […]

解压缩在中间停止,输出文件用零填充(BLACK PIXELS)?

我试图在bmp(位图)文件上应用DCT(离散余弦变换)压缩。 我有一个我在Turbo C ++中运行的ac文件。 这实际上并没有压缩,但我试图实现DCT和IDCT。 代码如下: /* the image to be compressed is a bmp with 24 bpp and with name “college4.bmp” of dimensions 200*160 ie 25*20- 8*8 blocks o/p is college2.dat format: 8 bit signed integers starting rowwise from 0,0 to 8,8 the coefficients order is blue,green,red for the block no 1 then 2 […]

离散余弦变换DCT实现C.

我试图在C中实现正向和反向离散余弦变换(DCT)。代码是通过dct()函数将单个输入像素块转换为变换矩阵,然后通过idct返回到原始像素值( )function。 请参阅附带的代码。 我的输出formsidct是连续值244,116,244,116等。从idct值的外观,它看起来不像我的程序正在工作..有人可以帮助我,让我知道结果是什么每个function后应该期待什么? 显然,在idct之后,我应该得到prety接近原始输入矩阵。 谢谢 # include # define PI 3.14 void dct(float [][]); // Function prototypes void idct(float [][]); // Function prototypes void dct(float inMatrix[8][8]){ double dct, Cu, sum, Cv; int i, j, u, h = 0, v; FILE * fp = fopen(“mydata.csv”, “w”); float dctMatrix[8][8], greyLevel; for (u = 0; u < […]