0

正如您在下面看到的,我有一个 8*8 的 dct 系数块:

-15 -4  1   0   -1  0   0   0

-2  4   1   0   0   0   0   0

0   -1  0   0   0   0   0   0

0   -1  0   0   0   1   0   0

0   0   0   0   0   0   0   0

0   0   1   0   0   0   0   0

0   0   0   0   0   0   0   0

0   0   0   0   0   0   0   0

我想得到真正的 y 系数,在对这个系数应用 idct 并添加 128 之后,结果是这样的:

119.993426127535    126.888835114344    127.977696208510    127.927114351222        127.622279963961    128.082250099117    127.919020270720    128

110.618267653250    126.957277975089    128.512507515489    127.935799524109    127.652389552519    128.091154805775    127.920065584190    128

136.573473239279    126.731190069890    128.405721622535    128.112408043987    127.702833109785    128.107866961225    127.922142717875    128

129.021166892476    127.268982345310    128.548746332762    128.260434777201    127.765160400749    128.130308763796    127.925224859437    128

124.152790434774    128.546202893775    127.700274478973    128.542888328457    127.836336292186    128.155643097180    127.929272223560    128

125.286184045103    128.030353688936    127.781062129255    128.439029577033    127.908068371778    128.180576157610    127.934232565512    128

125.224675818317    127.265893030837    127.509645458388    128.389987887226    127.958269682974    128.201709869820    127.940041855539    128

128.255190377282    127.039510378121    128.173941210798    128.024900885058    127.962852628740    128.215907305019    127.946625105377    128

但我期待得到这个结果:

88  72  72  56  38  75  109 89

69  88  86  69  73  82  76  65

86  114 83  48  69  77  67  81

90  106 80  49  62  81  86  95

55  64  86  88  81  103 112 83

51  49  77  87  75  112 138 106

56  64  69  63  75  113 139 134

29  73  77  75  111 126 114 119

我不知道我在这个过程中缺少什么。

4

1 回答 1

1

I think you missed the quantization step.

The jpeg header must include a 8x8 quantization table. Simply multiply each coefficient of your 8x8 block by the corresponding coefficient from the quantization table before applying the inverse DCT, and you should get the right results!

于 2013-09-06T12:43:16.297 回答