Lines 1-149
Link Here
|
1 |
--- jpwl/jpwl.c.orig 2007-11-29 15:38:26.000000000 +0100 |
|
|
2 |
+++ jpwl/jpwl.c 2009-03-21 12:36:53.000000000 +0100 |
3 |
@@ -122,19 +122,19 @@ |
4 |
switch (jwmarker[mm].id) { |
5 |
|
6 |
case J2K_MS_EPB: |
7 |
- free(jwmarker[mm].epbmark); |
8 |
+ opj_aligned_free(jwmarker[mm].u.epbmark); |
9 |
break; |
10 |
|
11 |
case J2K_MS_EPC: |
12 |
- free(jwmarker[mm].epcmark); |
13 |
+ opj_aligned_free(jwmarker[mm].u.epcmark); |
14 |
break; |
15 |
|
16 |
case J2K_MS_ESD: |
17 |
- free(jwmarker[mm].esdmark); |
18 |
+ opj_aligned_free(jwmarker[mm].u.esdmark); |
19 |
break; |
20 |
|
21 |
case J2K_MS_RED: |
22 |
- free(jwmarker[mm].redmark); |
23 |
+ opj_aligned_free(jwmarker[mm].u.redmark); |
24 |
break; |
25 |
|
26 |
default: |
27 |
@@ -213,7 +213,7 @@ |
28 |
/* Add this marker to the 'insertanda' list */ |
29 |
if (epc_mark) { |
30 |
jwmarker[jwmarker_num].id = J2K_MS_EPC; /* its type */ |
31 |
- jwmarker[jwmarker_num].epcmark = epc_mark; /* the EPC */ |
32 |
+ jwmarker[jwmarker_num].u.epcmark = epc_mark; /* the EPC */ |
33 |
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */ |
34 |
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.1; /* not so first */ |
35 |
jwmarker[jwmarker_num].len = epc_mark->Lepc; /* its length */ |
36 |
@@ -258,7 +258,7 @@ |
37 |
/* Add this marker to the 'insertanda' list */ |
38 |
if (jwmarker_num < JPWL_MAX_NO_MARKERS) { |
39 |
jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */ |
40 |
- jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */ |
41 |
+ jwmarker[jwmarker_num].u.esdmark = esd_mark; /* the EPB */ |
42 |
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* we choose to place it after SIZ */ |
43 |
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */ |
44 |
jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */ |
45 |
@@ -352,7 +352,7 @@ |
46 |
/* Add this marker to the 'insertanda' list */ |
47 |
if (jwmarker_num < JPWL_MAX_NO_MARKERS) { |
48 |
jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */ |
49 |
- jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */ |
50 |
+ jwmarker[jwmarker_num].u.esdmark = esd_mark; /* the EPB */ |
51 |
/****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */ |
52 |
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */ |
53 |
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */ |
54 |
@@ -430,7 +430,7 @@ |
55 |
/* Add this marker to the 'insertanda' list */ |
56 |
if (jwmarker_num < JPWL_MAX_NO_MARKERS) { |
57 |
jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */ |
58 |
- jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */ |
59 |
+ jwmarker[jwmarker_num].u.epbmark = epb_mark; /* the EPB */ |
60 |
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */ |
61 |
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */ |
62 |
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */ |
63 |
@@ -528,7 +528,7 @@ |
64 |
/* Add this marker to the 'insertanda' list */ |
65 |
if (jwmarker_num < JPWL_MAX_NO_MARKERS) { |
66 |
jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */ |
67 |
- jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */ |
68 |
+ jwmarker[jwmarker_num].u.epbmark = epb_mark; /* the EPB */ |
69 |
/****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */ |
70 |
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */ |
71 |
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */ |
72 |
@@ -758,15 +758,15 @@ |
73 |
switch (jwmarker[mm].id) { |
74 |
|
75 |
case J2K_MS_EPB: |
76 |
- jpwl_epb_write(j2k, jwmarker[mm].epbmark, jpwl_buf); |
77 |
+ jpwl_epb_write(j2k, jwmarker[mm].u.epbmark, jpwl_buf); |
78 |
break; |
79 |
|
80 |
case J2K_MS_EPC: |
81 |
- jpwl_epc_write(j2k, jwmarker[mm].epcmark, jpwl_buf); |
82 |
+ jpwl_epc_write(j2k, jwmarker[mm].u.epcmark, jpwl_buf); |
83 |
break; |
84 |
|
85 |
case J2K_MS_ESD: |
86 |
- jpwl_esd_write(j2k, jwmarker[mm].esdmark, jpwl_buf); |
87 |
+ jpwl_esd_write(j2k, jwmarker[mm].u.esdmark, jpwl_buf); |
88 |
break; |
89 |
|
90 |
case J2K_MS_RED: |
91 |
@@ -812,11 +812,11 @@ |
92 |
unsigned short int mycrc = 0x0000; |
93 |
|
94 |
/* fix and fill the DL field */ |
95 |
- jwmarker[mm].epcmark->DL = new_size; |
96 |
- orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].epcmark->DL >> 24); |
97 |
- orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].epcmark->DL >> 16); |
98 |
- orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].epcmark->DL >> 8); |
99 |
- orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].epcmark->DL >> 0); |
100 |
+ jwmarker[mm].u.epcmark->DL = new_size; |
101 |
+ orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 24); |
102 |
+ orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 16); |
103 |
+ orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 8); |
104 |
+ orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 0); |
105 |
|
106 |
/* compute the CRC field (excluding itself) */ |
107 |
for (pp = 0; pp < 4; pp++) |
108 |
@@ -825,9 +825,9 @@ |
109 |
jpwl_updateCRC16(&mycrc, orig_buf[epc_pos + pp]); |
110 |
|
111 |
/* fix and fill the CRC */ |
112 |
- jwmarker[mm].epcmark->Pcrc = mycrc; |
113 |
- orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].epcmark->Pcrc >> 8); |
114 |
- orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].epcmark->Pcrc >> 0); |
115 |
+ jwmarker[mm].u.epcmark->Pcrc = mycrc; |
116 |
+ orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].u.epcmark->Pcrc >> 8); |
117 |
+ orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].u.epcmark->Pcrc >> 0); |
118 |
|
119 |
} |
120 |
} |
121 |
@@ -842,7 +842,7 @@ |
122 |
/* remember that they are now in a new position (dpos) */ |
123 |
int esd_pos = (int) jwmarker[mm].dpos; |
124 |
|
125 |
- jpwl_esd_fill(j2k, jwmarker[mm].esdmark, &orig_buf[esd_pos]); |
126 |
+ jpwl_esd_fill(j2k, jwmarker[mm].u.esdmark, &orig_buf[esd_pos]); |
127 |
|
128 |
} |
129 |
|
130 |
@@ -867,16 +867,16 @@ |
131 |
accum_len = 0; |
132 |
for (nn = mm; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) && |
133 |
(jwmarker[nn].pos == jwmarker[mm].pos); nn++) |
134 |
- accum_len += jwmarker[nn].epbmark->Lepb + 2; |
135 |
+ accum_len += jwmarker[nn].u.epbmark->Lepb + 2; |
136 |
|
137 |
/* fill the current (first) EPB with post-data starting from the computed position */ |
138 |
- jpwl_epb_fill(j2k, jwmarker[mm].epbmark, &orig_buf[(int) jwmarker[mm].dpos], |
139 |
+ jpwl_epb_fill(j2k, jwmarker[mm].u.epbmark, &orig_buf[(int) jwmarker[mm].dpos], |
140 |
&orig_buf[(int) jwmarker[mm].dpos + accum_len]); |
141 |
|
142 |
/* fill the remaining EPBs in the header with post-data starting from the last position */ |
143 |
for (nn = mm + 1; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) && |
144 |
(jwmarker[nn].pos == jwmarker[mm].pos); nn++) |
145 |
- jpwl_epb_fill(j2k, jwmarker[nn].epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL); |
146 |
+ jpwl_epb_fill(j2k, jwmarker[nn].u.epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL); |
147 |
|
148 |
/* skip all the processed EPBs */ |
149 |
mm = nn - 1; |