📄 jpc_qmfb.c
字号:
lptr = &a[0];
hptr = &a[llen];
if (parity) {
jpc_fix_pluseq(hptr[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA),
lptr[0]));
++hptr;
}
n = numcols - llen - parity - (parity == (numcols & 1));
while (n-- > 0) {
jpc_fix_pluseq(hptr[0], jpc_fix_mul(jpc_dbltofix(GAMMA),
jpc_fix_add(lptr[0], lptr[1])));
++hptr;
++lptr;
}
if (parity == (numcols & 1)) {
jpc_fix_pluseq(hptr[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA),
lptr[0]));
}
/* Apply the fourth lifting step. */
lptr = &a[0];
hptr = &a[llen];
if (!parity) {
jpc_fix_pluseq(lptr[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA),
hptr[0]));
++lptr;
}
n = llen - (!parity) - (parity != (numcols & 1));
while (n-- > 0) {
jpc_fix_pluseq(lptr[0], jpc_fix_mul(jpc_dbltofix(DELTA),
jpc_fix_add(hptr[0], hptr[1])));
++lptr;
++hptr;
}
if (parity != (numcols & 1)) {
jpc_fix_pluseq(lptr[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA),
hptr[0]));
}
/* Apply the scaling step. */
#if defined(WT_DOSCALE)
lptr = &a[0];
n = llen;
while (n-- > 0) {
lptr[0] = jpc_fix_mul(lptr[0], jpc_dbltofix(LGAIN));
++lptr;
}
hptr = &a[llen];
n = numcols - llen;
while (n-- > 0) {
hptr[0] = jpc_fix_mul(hptr[0], jpc_dbltofix(HGAIN));
++hptr;
}
#endif
} else {
#if defined(WT_LENONE)
if (parity) {
lptr = &a[0];
lptr[0] <<= 1;
}
#endif
}
}
void jpc_ns_fwdlift_colgrp(jpc_fix_t *a, int numrows, int stride,
int parity)
{
jpc_fix_t *lptr;
jpc_fix_t *hptr;
register jpc_fix_t *lptr2;
register jpc_fix_t *hptr2;
register int n;
register int i;
int llen;
llen = (numrows + 1 - parity) >> 1;
if (numrows > 1) {
/* Apply the first lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA),
lptr2[0]));
++hptr2;
++lptr2;
}
hptr += stride;
}
n = numrows - llen - parity - (parity == (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(ALPHA),
jpc_fix_add(lptr2[0], lptr2[stride])));
++lptr2;
++hptr2;
}
hptr += stride;
lptr += stride;
}
if (parity == (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA),
lptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the second lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (!parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA),
hptr2[0]));
++lptr2;
++hptr2;
}
lptr += stride;
}
n = llen - (!parity) - (parity != (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(BETA),
jpc_fix_add(hptr2[0], hptr2[stride])));
++lptr2;
++hptr2;
}
lptr += stride;
hptr += stride;
}
if (parity != (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA),
hptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the third lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA),
lptr2[0]));
++hptr2;
++lptr2;
}
hptr += stride;
}
n = numrows - llen - parity - (parity == (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(GAMMA),
jpc_fix_add(lptr2[0], lptr2[stride])));
++lptr2;
++hptr2;
}
hptr += stride;
lptr += stride;
}
if (parity == (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA),
lptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the fourth lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (!parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA),
hptr2[0]));
++lptr2;
++hptr2;
}
lptr += stride;
}
n = llen - (!parity) - (parity != (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(DELTA),
jpc_fix_add(hptr2[0], hptr2[stride])));
++lptr2;
++hptr2;
}
lptr += stride;
hptr += stride;
}
if (parity != (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA),
hptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the scaling step. */
#if defined(WT_DOSCALE)
lptr = &a[0];
n = llen;
while (n-- > 0) {
lptr2 = lptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
lptr2[0] = jpc_fix_mul(lptr2[0], jpc_dbltofix(LGAIN));
++lptr2;
}
lptr += stride;
}
hptr = &a[llen * stride];
n = numrows - llen;
while (n-- > 0) {
hptr2 = hptr;
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
hptr2[0] = jpc_fix_mul(hptr2[0], jpc_dbltofix(HGAIN));
++hptr2;
}
hptr += stride;
}
#endif
} else {
#if defined(WT_LENONE)
if (parity) {
lptr2 = &a[0];
for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) {
lptr2[0] <<= 1;
++lptr2;
}
}
#endif
}
}
void jpc_ns_fwdlift_colres(jpc_fix_t *a, int numrows, int numcols,
int stride, int parity)
{
jpc_fix_t *lptr;
jpc_fix_t *hptr;
register jpc_fix_t *lptr2;
register jpc_fix_t *hptr2;
register int n;
register int i;
int llen;
llen = (numrows + 1 - parity) >> 1;
if (numrows > 1) {
/* Apply the first lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA),
lptr2[0]));
++hptr2;
++lptr2;
}
hptr += stride;
}
n = numrows - llen - parity - (parity == (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(ALPHA),
jpc_fix_add(lptr2[0], lptr2[stride])));
++lptr2;
++hptr2;
}
hptr += stride;
lptr += stride;
}
if (parity == (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA),
lptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the second lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (!parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA),
hptr2[0]));
++lptr2;
++hptr2;
}
lptr += stride;
}
n = llen - (!parity) - (parity != (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(BETA),
jpc_fix_add(hptr2[0], hptr2[stride])));
++lptr2;
++hptr2;
}
lptr += stride;
hptr += stride;
}
if (parity != (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA),
hptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the third lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA),
lptr2[0]));
++hptr2;
++lptr2;
}
hptr += stride;
}
n = numrows - llen - parity - (parity == (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(GAMMA),
jpc_fix_add(lptr2[0], lptr2[stride])));
++lptr2;
++hptr2;
}
hptr += stride;
lptr += stride;
}
if (parity == (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA),
lptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the fourth lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (!parity) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA),
hptr2[0]));
++lptr2;
++hptr2;
}
lptr += stride;
}
n = llen - (!parity) - (parity != (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(DELTA),
jpc_fix_add(hptr2[0], hptr2[stride])));
++lptr2;
++hptr2;
}
lptr += stride;
hptr += stride;
}
if (parity != (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA),
hptr2[0]));
++lptr2;
++hptr2;
}
}
/* Apply the scaling step. */
#if defined(WT_DOSCALE)
lptr = &a[0];
n = llen;
while (n-- > 0) {
lptr2 = lptr;
for (i = 0; i < numcols; ++i) {
lptr2[0] = jpc_fix_mul(lptr2[0], jpc_dbltofix(LGAIN));
++lptr2;
}
lptr += stride;
}
hptr = &a[llen * stride];
n = numrows - llen;
while (n-- > 0) {
hptr2 = hptr;
for (i = 0; i < numcols; ++i) {
hptr2[0] = jpc_fix_mul(hptr2[0], jpc_dbltofix(HGAIN));
++hptr2;
}
hptr += stride;
}
#endif
} else {
#if defined(WT_LENONE)
if (parity) {
lptr2 = &a[0];
for (i = 0; i < numcols; ++i) {
lptr2[0] <<= 1;
++lptr2;
}
}
#endif
}
}
void jpc_ns_fwdlift_col(jpc_fix_t *a, int numrows, int stride,
int parity)
{
jpc_fix_t *lptr;
jpc_fix_t *hptr;
register jpc_fix_t *lptr2;
register jpc_fix_t *hptr2;
register int n;
int llen;
llen = (numrows + 1 - parity) >> 1;
if (numrows > 1) {
/* Apply the first lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (parity) {
lptr2 = lptr;
hptr2 = hptr;
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA),
lptr2[0]));
++hptr2;
++lptr2;
hptr += stride;
}
n = numrows - llen - parity - (parity == (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(ALPHA),
jpc_fix_add(lptr2[0], lptr2[stride])));
++lptr2;
++hptr2;
hptr += stride;
lptr += stride;
}
if (parity == (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
jpc_fix_pluseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA),
lptr2[0]));
++lptr2;
++hptr2;
}
/* Apply the second lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (!parity) {
lptr2 = lptr;
hptr2 = hptr;
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA),
hptr2[0]));
++lptr2;
++hptr2;
lptr += stride;
}
n = llen - (!parity) - (parity != (numrows & 1));
while (n-- > 0) {
lptr2 = lptr;
hptr2 = hptr;
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(BETA),
jpc_fix_add(hptr2[0], hptr2[stride])));
++lptr2;
++hptr2;
lptr += stride;
hptr += stride;
}
if (parity != (numrows & 1)) {
lptr2 = lptr;
hptr2 = hptr;
jpc_fix_pluseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA),
hptr2[0]));
++lptr2;
++hptr2;
}
/* Apply the third lifting step. */
lptr = &a[0];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -