如下所示,我有一个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
我不知道在这个过程中我错过了什么。
答案 0 :(得分:1)
我认为你错过了quantization步骤。
jpeg标头必须包含8x8量化表。在应用逆DCT之前,简单地将8x8块的每个系数乘以量化表中的相应系数,您应该得到正确的结果!