324 else if (
vlcp->size > 0)
327 while (
vlcp->size > 0) {
336 ui32 tmp = val >> 24;
340 bits = 8 - ((
vlcp->unstuff && (((val >> 24) & 0x7F) == 0x7F)) ? 1 : 0);
341 bool unstuff = (val >> 24) > 0x8F;
343 tmp |= ((val >> 16) & 0xFF) << bits;
344 bits += 8 - ((unstuff && (((val >> 16) & 0x7F) == 0x7F)) ? 1 : 0);
345 unstuff = ((val >> 16) & 0xFF) > 0x8F;
347 tmp |= ((val >> 8) & 0xFF) << bits;
348 bits += 8 - ((unstuff && (((val >> 8) & 0x7F) == 0x7F)) ? 1 : 0);
349 unstuff = ((val >> 8) & 0xFF) > 0x8F;
351 tmp |= (val & 0xFF) << bits;
352 bits += 8 - ((unstuff && ((val & 0x7F) == 0x7F)) ? 1 : 0);
353 unstuff = (val & 0xFF) > 0x8F;
358 vlcp->unstuff = unstuff;
467 else if (
mrp->size > 0)
470 while (
mrp->size > 0) {
479 ui32 bits, tmp = val >> 24;
482 bits = 8 - ((
mrp->unstuff && (((val >> 24) & 0x7F) == 0x7F)) ? 1 : 0);
483 bool unstuff = (val >> 24) > 0x8F;
486 tmp |= ((val >> 16) & 0xFF) << bits;
487 bits += 8 - ((unstuff && (((val >> 16) & 0x7F) == 0x7F)) ? 1 : 0);
488 unstuff = ((val >> 16) & 0xFF) > 0x8F;
490 tmp |= ((val >> 8) & 0xFF) << bits;
491 bits += 8 - ((unstuff && (((val >> 8) & 0x7F) == 0x7F)) ? 1 : 0);
492 unstuff = ((val >> 8) & 0xFF) > 0x8F;
494 tmp |= (val & 0xFF) << bits;
495 bits += 8 - ((unstuff && ((val & 0x7F) == 0x7F)) ? 1 : 0);
496 unstuff = (val & 0xFF) > 0x8F;
500 mrp->unstuff = unstuff;
907 0x0100, 0x0100, 0x0100, 0x0100));
911 (
si16)0x8880, 0x4440, 0x2220, 0x1110));
917 0x0100, 0x0100, 0x0100, 0x0100));
945 0x0606, 0x0404, 0x0202, 0x0000));
954 1, 3, 7, 15, 31, 63, 127, -1),
bit_idx);
1023 ui32 missing_msbs,
ui32 num_passes,
1032 if (num_passes > 1 &&
lengths2 == 0)
1034 OJPH_WARN(0x00010001,
"A malformed codeblock that has more than "
1035 "one coding pass, but zero length for "
1036 "2nd and potential 3rd pass.\n");
1042 OJPH_WARN(0x00010002,
"We do not support more than 3 coding passes; "
1043 "This codeblocks has %d passes.\n",
1048 if (missing_msbs > 30)
1053 OJPH_WARN(0x00010003,
"32 bits are not enough to decode this "
1054 "codeblock. This message will not be "
1055 "displayed again.\n");
1059 else if (missing_msbs == 30)
1063 OJPH_WARN(0x00010004,
"Not enough precision to decode the cleanup "
1064 "pass. The code can be modified to support "
1065 "this case. This message will not be "
1066 "displayed again.\n");
1070 else if (missing_msbs == 29)
1072 if (num_passes > 1) {
1076 OJPH_WARN(0x00010005,
"Not enough precision to decode the SgnProp "
1077 "nor MagRef passes; both will be skipped. "
1078 "This message will not be displayed "
1083 ui32 p = 30 - missing_msbs;
1089 OJPH_WARN(0x00010006,
"Wrong codeblock length.\n");
1116 ui16 scratch[8 * 513] = {0};
1124 ui32 sstr = ((width + 2u) + 7u) & ~7u;
1126 assert((stride & 0x3) == 0);
1152 for (
ui32 x = 0; x < width;
sp += 4)
1171 t0 = (run == -1) ?
t0 : 0;
1185 c_q = ((
t0 & 0x10U) << 3) | ((
t0 & 0xE0U) << 2);
1197 if (
c_q == 0 && x < width)
1202 t1 = (run == -1) ?
t1 : 0;
1207 t1 = x < width ?
t1 : 0;
1216 c_q = ((
t1 & 0x10U) << 3) | ((
t1 & 0xE0U) << 2);
1261 for (
ui32 y = 2; y < height; y += 2)
1266 for (
ui32 x = 0; x < width;
sp += 4)
1289 t0 = (run == -1) ?
t0 : 0;
1304 c_q = ((
t0 & 0x40U) << 2) | ((
t0 & 0x80U) << 1);
1321 if (
c_q == 0 && x < width)
1326 t1 = (run == -1) ?
t1 : 0;
1331 t1 = x < width ?
t1 : 0;
1341 c_q = ((
t1 & 0x40U) << 2) | ((
t1 & 0x80U) << 1);
1401 for (
ui32 x = 0; x < width; x += 4,
sp += 4,
vp += 2,
dp += 4)
1435 for (
ui32 y = 2; y < height; y += 2)
1441 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 31
1444 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 31
1450 for (
ui32 x = 0; x <= width; x += 8,
vp += 4)
1479 for (
ui32 x = 0; x < width; x += 4,
sp += 4,
vp += 2,
dp += 4)
1552 for (
ui32 x = 0; x < width; x += 4,
sp += 4,
vp += 2,
dp += 4)
1578 0x0504, -1, 0x0100, -1));
1582 0x0706, -1, 0x0302, -1));
1587 for (
ui32 y = 2; y < height; y += 2)
1593 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 15
1596 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 15
1601 for (
ui32 x = 0; x <= width; x += 16,
vp += 8)
1626 for (
ui32 x = 0; x < width; x += 4,
sp += 4,
vp += 2,
dp += 4)
1646 -1, 0x0302, -1, 0x0100));
1670 0x0504, -1, 0x0100, -1));
1674 0x0706, -1, 0x0302, -1));
1704 for (y = 0; y < height; y += 4)
1708 for (
ui32 x = 0; x < width; x += 8,
sp += 8,
dp += 2)
1737 for (
ui32 x = 0; x < width; x += 32,
dp += 8)
1759 for (
ui32 y = 0; y < height; y += 4)
1762 if (height - y < 4) {
1764 if (height - y < 3) {
1798 ui32 u = (
ps & 0x88888888) >> 3;
1800 u |= (
ns & 0x11111111) << 3;
1805 mbr |= (
cs & 0x77777777) << 1;
1806 mbr |= (
cs & 0xEEEEEEEE) >> 1;
1891 _mm_set_epi8(1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0));
1913 _mm_set_epi8(1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0));
1926 _mm_set_epi8(-1,-1,-1,12,-1,-1,-1,8,-1,-1,-1,4,-1,-1,-1,0);
1929 for (
int c = 0;
c < 4; ++
c) {
1978 for (
ui32 y = 0; y < height; y += 4)
1982 for (
ui32 i = 0;
i < width;
i += 4,
dpp += 4)
1997 _mm_set_epi8(1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0));
2021 _mm_set_epi8(1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0));
2032 _mm_set_epi8(-1,-1,-1,12,-1,-1,-1,8,-1,-1,-1,4,-1,-1,-1,0);
2034 for (
int c = 0;
c < 4; ++
c) {
bool ojph_decode_codeblock_ssse3(ui8 *coded_data, ui32 *decoded_data, ui32 missing_msbs, ui32 num_passes, ui32 lengths1, ui32 lengths2, ui32 width, ui32 height, ui32 stride, bool stripe_causal)
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pa...