1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <stdint.h>
38
39#include "tinyjpeg.h"
40#include "tinyjpeg-internal.h"
41
42
43
44
45static void decode_MCU_1x1_1plane(struct jdec_private *priv)
46{
47
48 tinyjpeg_process_Huffman_data_unit(priv, cY);
49 IDCT(&priv->component_infos[cY], priv->Y, 8);
50
51
52 tinyjpeg_process_Huffman_data_unit(priv, cCb);
53 IDCT(&priv->component_infos[cCb], priv->Cb, 8);
54
55
56 tinyjpeg_process_Huffman_data_unit(priv, cCr);
57 IDCT(&priv->component_infos[cCr], priv->Cr, 8);
58}
59
60
61
62
63
64
65
66
67static void decode_MCU_2x1_1plane(struct jdec_private *priv)
68{
69
70 tinyjpeg_process_Huffman_data_unit(priv, cY);
71 IDCT(&priv->component_infos[cY], priv->Y, 16);
72 tinyjpeg_process_Huffman_data_unit(priv, cY);
73 IDCT(&priv->component_infos[cY], priv->Y+8, 16);
74
75
76 tinyjpeg_process_Huffman_data_unit(priv, cCb);
77
78
79 tinyjpeg_process_Huffman_data_unit(priv, cCr);
80}
81
82
83
84
85
86
87
88
89
90
91static void decode_MCU_2x2_1plane(struct jdec_private *priv)
92{
93
94 tinyjpeg_process_Huffman_data_unit(priv, cY);
95 IDCT(&priv->component_infos[cY], priv->Y, 16);
96 tinyjpeg_process_Huffman_data_unit(priv, cY);
97 IDCT(&priv->component_infos[cY], priv->Y+8, 16);
98 tinyjpeg_process_Huffman_data_unit(priv, cY);
99 IDCT(&priv->component_infos[cY], priv->Y+64*2, 16);
100 tinyjpeg_process_Huffman_data_unit(priv, cY);
101 IDCT(&priv->component_infos[cY], priv->Y+64*2+8, 16);
102
103
104 tinyjpeg_process_Huffman_data_unit(priv, cCb);
105
106
107 tinyjpeg_process_Huffman_data_unit(priv, cCr);
108}
109
110
111
112
113
114
115
116
117
118static void decode_MCU_1x2_1plane(struct jdec_private *priv)
119{
120
121 tinyjpeg_process_Huffman_data_unit(priv, cY);
122 IDCT(&priv->component_infos[cY], priv->Y, 8);
123 tinyjpeg_process_Huffman_data_unit(priv, cY);
124 IDCT(&priv->component_infos[cY], priv->Y+64, 8);
125
126
127 tinyjpeg_process_Huffman_data_unit(priv, cCb);
128
129
130 tinyjpeg_process_Huffman_data_unit(priv, cCr);
131}
132
133const decode_MCU_fct tinyjpeg_decode_mcu_1comp_table[4] = {
134 decode_MCU_1x1_1plane,
135 decode_MCU_1x2_1plane,
136 decode_MCU_2x1_1plane,
137 decode_MCU_2x2_1plane,
138};
139