// Note: block length must be even for this implementation staticvoid analysis_53_row(int length, tran_low_t *x, tran_low_t *lowpass,
tran_low_t *highpass) {
int n;
tran_low_t r, *a, *b;
n = length >> 1;
b = highpass;
a = lowpass; while (--n) {
*a++ = (r = *x++);
*b++ = (((*x) * 2) - (r + x[1]) + 2) >> 2;
x++;
}
*a = (r = *x++);
*b = (*x - r + 1) >> 1;
n = length >> 1;
b = highpass;
a = lowpass;
r = *highpass; while (n--) {
*a++ += (r + (*b) + 1) >> 1;
r = *b++;
}
}
staticvoid dyadic_analyze_53_uint8_input(int levels, int width, int height, const uint8_t *x, int pitch_x,
tran_low_t *c, int pitch_c,
int dwt_scale_bits, int hbd) {
int lv, i, j, nh, nw, hh = height, hw = width;
tran_low_t buffer[2 * DWT_MAX_LENGTH];
if (hbd) { const uint16_t *x16 = CONVERT_TO_SHORTPTR(x);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
c[i * pitch_c + j] = x16[i * pitch_x + j] << dwt_scale_bits;
}
}
} else {
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
c[i * pitch_c + j] = x[i * pitch_x + j] << dwt_scale_bits;
}
}
}
for (lv = 0; lv < levels; lv++) {
nh = hh;
hh = (hh + 1) >> 1;
nw = hw;
hw = (hw + 1) >> 1;
if ((nh < 2) || (nw < 2)) return;
for (i = 0; i < nh; i++) {
memcpy(buffer, &c[i * pitch_c], nw * sizeof(tran_low_t));
analysis_53_row(nw, buffer, &c[i * pitch_c], &c[i * pitch_c] + hw);
}
for (j = 0; j < nw; j++) {
for (i = 0; i < nh; i++) buffer[i + nh] = c[i * pitch_c + j];
analysis_53_col(nh, buffer + nh, buffer, buffer + hh);
for (i = 0; i < nh; i++) c[i * pitch_c + j] = buffer[i];
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.