ui: vnc: finish removing TABs

Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2018-12-14 12:38:28 +01:00
parent 2f9f96b242
commit b86d01ba47
2 changed files with 321 additions and 321 deletions

View File

@ -30,127 +30,127 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
int n_subtiles = 0; int n_subtiles = 0;
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) { for (i = 0; i < w; i++) {
switch (n_colors) { switch (n_colors) {
case 0: case 0:
bg = irow[i]; bg = irow[i];
n_colors = 1; n_colors = 1;
break; break;
case 1: case 1:
if (irow[i] != bg) { if (irow[i] != bg) {
fg = irow[i]; fg = irow[i];
n_colors = 2; n_colors = 2;
} }
break; break;
case 2: case 2:
if (irow[i] != bg && irow[i] != fg) { if (irow[i] != bg && irow[i] != fg) {
n_colors = 3; n_colors = 3;
} else { } else {
if (irow[i] == bg) if (irow[i] == bg)
bg_count++; bg_count++;
else if (irow[i] == fg) else if (irow[i] == fg)
fg_count++; fg_count++;
} }
break; break;
default: default:
break; break;
} }
} }
if (n_colors > 2) if (n_colors > 2)
break; break;
irow += vnc_server_fb_stride(vd) / sizeof(pixel_t); irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
} }
if (n_colors > 1 && fg_count > bg_count) { if (n_colors > 1 && fg_count > bg_count) {
pixel_t tmp = fg; pixel_t tmp = fg;
fg = bg; fg = bg;
bg = tmp; bg = tmp;
} }
if (!*has_bg || *last_bg != bg) { if (!*has_bg || *last_bg != bg) {
flags |= 0x02; flags |= 0x02;
*has_bg = 1; *has_bg = 1;
*last_bg = bg; *last_bg = bg;
} }
if (n_colors < 3 && (!*has_fg || *last_fg != fg)) { if (n_colors < 3 && (!*has_fg || *last_fg != fg)) {
flags |= 0x04; flags |= 0x04;
*has_fg = 1; *has_fg = 1;
*last_fg = fg; *last_fg = fg;
} }
switch (n_colors) { switch (n_colors) {
case 1: case 1:
n_data = 0; n_data = 0;
break; break;
case 2: case 2:
flags |= 0x08; flags |= 0x08;
irow = (pixel_t *)row; irow = (pixel_t *)row;
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
int min_x = -1; int min_x = -1;
for (i = 0; i < w; i++) { for (i = 0; i < w; i++) {
if (irow[i] == fg) { if (irow[i] == fg) {
if (min_x == -1) if (min_x == -1)
min_x = i; min_x = i;
} else if (min_x != -1) { } else if (min_x != -1) {
hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
n_data += 2; n_data += 2;
n_subtiles++; n_subtiles++;
min_x = -1; min_x = -1;
} }
} }
if (min_x != -1) { if (min_x != -1) {
hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
n_data += 2; n_data += 2;
n_subtiles++; n_subtiles++;
} }
irow += vnc_server_fb_stride(vd) / sizeof(pixel_t); irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
} }
break; break;
case 3: case 3:
flags |= 0x18; flags |= 0x18;
irow = (pixel_t *)row; irow = (pixel_t *)row;
if (!*has_bg || *last_bg != bg) if (!*has_bg || *last_bg != bg)
flags |= 0x02; flags |= 0x02;
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
int has_color = 0; int has_color = 0;
int min_x = -1; int min_x = -1;
pixel_t color = 0; /* shut up gcc */ pixel_t color = 0; /* shut up gcc */
for (i = 0; i < w; i++) { for (i = 0; i < w; i++) {
if (!has_color) { if (!has_color) {
if (irow[i] == bg) if (irow[i] == bg)
continue; continue;
color = irow[i]; color = irow[i];
min_x = i; min_x = i;
has_color = 1; has_color = 1;
} else if (irow[i] != color) { } else if (irow[i] != color) {
has_color = 0; has_color = 0;
#ifdef GENERIC #ifdef GENERIC
vnc_convert_pixel(vs, data + n_data, color); vnc_convert_pixel(vs, data + n_data, color);
n_data += vs->client_pf.bytes_per_pixel; n_data += vs->client_pf.bytes_per_pixel;
#else #else
memcpy(data + n_data, &color, sizeof(color)); memcpy(data + n_data, &color, sizeof(color));
n_data += sizeof(pixel_t); n_data += sizeof(pixel_t);
#endif #endif
hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
n_data += 2; n_data += 2;
n_subtiles++; n_subtiles++;
min_x = -1; min_x = -1;
if (irow[i] != bg) { if (irow[i] != bg) {
color = irow[i]; color = irow[i];
min_x = i; min_x = i;
has_color = 1; has_color = 1;
} }
} }
} }
if (has_color) { if (has_color) {
#ifdef GENERIC #ifdef GENERIC
vnc_convert_pixel(vs, data + n_data, color); vnc_convert_pixel(vs, data + n_data, color);
n_data += vs->client_pf.bytes_per_pixel; n_data += vs->client_pf.bytes_per_pixel;
@ -158,50 +158,50 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
memcpy(data + n_data, &color, sizeof(color)); memcpy(data + n_data, &color, sizeof(color));
n_data += sizeof(pixel_t); n_data += sizeof(pixel_t);
#endif #endif
hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
n_data += 2; n_data += 2;
n_subtiles++; n_subtiles++;
} }
irow += vnc_server_fb_stride(vd) / sizeof(pixel_t); irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
} }
/* A SubrectsColoured subtile invalidates the foreground color */ /* A SubrectsColoured subtile invalidates the foreground color */
*has_fg = 0; *has_fg = 0;
if (n_data > (w * h * sizeof(pixel_t))) { if (n_data > (w * h * sizeof(pixel_t))) {
n_colors = 4; n_colors = 4;
flags = 0x01; flags = 0x01;
*has_bg = 0; *has_bg = 0;
/* we really don't have to invalidate either the bg or fg /* we really don't have to invalidate either the bg or fg
but we've lost the old values. oh well. */ but we've lost the old values. oh well. */
} }
break; break;
default: default:
break; break;
} }
if (n_colors > 3) { if (n_colors > 3) {
flags = 0x01; flags = 0x01;
*has_fg = 0; *has_fg = 0;
*has_bg = 0; *has_bg = 0;
n_colors = 4; n_colors = 4;
} }
vnc_write_u8(vs, flags); vnc_write_u8(vs, flags);
if (n_colors < 4) { if (n_colors < 4) {
if (flags & 0x02) if (flags & 0x02)
vs->write_pixels(vs, last_bg, sizeof(pixel_t)); vs->write_pixels(vs, last_bg, sizeof(pixel_t));
if (flags & 0x04) if (flags & 0x04)
vs->write_pixels(vs, last_fg, sizeof(pixel_t)); vs->write_pixels(vs, last_fg, sizeof(pixel_t));
if (n_subtiles) { if (n_subtiles) {
vnc_write_u8(vs, n_subtiles); vnc_write_u8(vs, n_subtiles);
vnc_write(vs, data, n_data); vnc_write(vs, data, n_data);
} }
} else { } else {
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
vs->write_pixels(vs, row, w * 4); vs->write_pixels(vs, row, w * 4);
row += vnc_server_fb_stride(vd); row += vnc_server_fb_stride(vd);
} }
} }
} }

View File

@ -48,162 +48,162 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ZYWRLE_QUANTIZE #ifndef ZYWRLE_QUANTIZE
/* Type A:lower bit omitting of EZW style. */ /* Type A:lower bit omitting of EZW style. */
static const unsigned int zywrle_param[3][3]={ static const unsigned int zywrle_param[3][3]={
{0x0000F000, 0x00000000, 0x00000000}, {0x0000F000, 0x00000000, 0x00000000},
{0x0000C000, 0x00F0F0F0, 0x00000000}, {0x0000C000, 0x00F0F0F0, 0x00000000},
{0x0000C000, 0x00C0C0C0, 0x00F0F0F0}, {0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
/* {0x0000FF00, 0x00000000, 0x00000000}, /* {0x0000FF00, 0x00000000, 0x00000000},
{0x0000FF00, 0x00FFFFFF, 0x00000000}, {0x0000FF00, 0x00FFFFFF, 0x00000000},
{0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */ {0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
}; };
#else #else
/* Type B:Non liner quantization filter. */ /* Type B:Non liner quantization filter. */
static const int8_t zywrle_conv[4][256]={ static const int8_t zywrle_conv[4][256]={
{ /* bi=5, bo=5 r=0.0:PSNR=24.849 */ { /* bi=5, bo=5 r=0.0:PSNR=24.849 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}, },
{ /* bi=5, bo=5 r=2.0:PSNR=74.031 */ { /* bi=5, bo=5 r=2.0:PSNR=74.031 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 56, 56, 56, 56, 56, 48, 48, 48, 56, 56, 56, 56, 56,
56, 56, 56, 56, 64, 64, 64, 64, 56, 56, 56, 56, 64, 64, 64, 64,
64, 64, 64, 64, 72, 72, 72, 72, 64, 64, 64, 64, 72, 72, 72, 72,
72, 72, 72, 72, 80, 80, 80, 80, 72, 72, 72, 72, 80, 80, 80, 80,
80, 80, 88, 88, 88, 88, 88, 88, 80, 80, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 96, 96, 88, 88, 88, 88, 88, 88, 96, 96,
96, 96, 96, 104, 104, 104, 104, 104, 96, 96, 96, 104, 104, 104, 104, 104,
104, 104, 104, 104, 104, 112, 112, 112, 104, 104, 104, 104, 104, 112, 112, 112,
112, 112, 112, 112, 112, 112, 120, 120, 112, 112, 112, 112, 112, 112, 120, 120,
120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
0, -120, -120, -120, -120, -120, -120, -120, 0, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -112, -112, -112, -112, -112, -120, -120, -120, -112, -112, -112, -112, -112,
-112, -112, -112, -112, -104, -104, -104, -104, -112, -112, -112, -112, -104, -104, -104, -104,
-104, -104, -104, -104, -104, -104, -96, -96, -104, -104, -104, -104, -104, -104, -96, -96,
-96, -96, -96, -88, -88, -88, -88, -88, -96, -96, -96, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -80, -88, -88, -88, -88, -88, -88, -88, -80,
-80, -80, -80, -80, -80, -72, -72, -72, -80, -80, -80, -80, -80, -72, -72, -72,
-72, -72, -72, -72, -72, -64, -64, -64, -72, -72, -72, -72, -72, -64, -64, -64,
-64, -64, -64, -64, -64, -56, -56, -56, -64, -64, -64, -64, -64, -56, -56, -56,
-56, -56, -56, -56, -56, -56, -48, -48, -56, -56, -56, -56, -56, -56, -48, -48,
-48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48,
-48, -32, -32, -32, -32, -32, -32, -32, -48, -32, -32, -32, -32, -32, -32, -32,
-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
-32, -32, 0, 0, 0, 0, 0, 0, -32, -32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}, },
{ /* bi=5, bo=4 r=2.0:PSNR=64.441 */ { /* bi=5, bo=4 r=2.0:PSNR=64.441 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 88, 88, 88, 80, 80, 80, 80, 80, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
104, 104, 104, 112, 112, 112, 112, 112, 104, 104, 104, 112, 112, 112, 112, 112,
112, 112, 112, 112, 120, 120, 120, 120, 112, 112, 112, 112, 120, 120, 120, 120,
120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
0, -120, -120, -120, -120, -120, -120, -120, 0, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -120, -120, -112, -112, -112, -120, -120, -120, -120, -120, -112, -112, -112,
-112, -112, -112, -112, -112, -112, -104, -104, -112, -112, -112, -112, -112, -112, -104, -104,
-104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
-104, -88, -88, -88, -88, -88, -88, -88, -104, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -80, -80, -80, -80, -88, -88, -88, -88, -80, -80, -80, -80,
-80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
-80, -64, -64, -64, -64, -64, -64, -64, -80, -64, -64, -64, -64, -64, -64, -64,
-64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64,
-64, -48, -48, -48, -48, -48, -48, -48, -64, -48, -48, -48, -48, -48, -48, -48,
-48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48,
-48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48,
-48, 0, 0, 0, 0, 0, 0, 0, -48, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}, },
{ /* bi=5, bo=2 r=2.0:PSNR=43.175 */ { /* bi=5, bo=2 r=2.0:PSNR=43.175 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
0, -88, -88, -88, -88, -88, -88, -88, 0, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, 0, 0, 0, 0, 0, 0, 0, -88, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
} }
}; };
static const int8_t *zywrle_param[3][3][3]={ static const int8_t *zywrle_param[3][3][3]={
{{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]}, {{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
{zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}, {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]},
{zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}}, {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]}, {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
{zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]}, {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]},
{zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}}, {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]}, {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
{zywrle_conv[2], zywrle_conv[2], zywrle_conv[2]}, {zywrle_conv[2], zywrle_conv[2], zywrle_conv[2]},
{zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]}}, {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]}},
}; };
@ -214,53 +214,53 @@ static const int8_t *zywrle_param[3][3][3]={
#define ZYWRLE_UVMASK15 0xFFFFFFF8 #define ZYWRLE_UVMASK15 0xFFFFFFF8
#define ZYWRLE_LOAD_PIXEL15(src, r, g, b) \ #define ZYWRLE_LOAD_PIXEL15(src, r, g, b) \
do { \ do { \
r = (((uint8_t*)src)[S_1]<< 1)& 0xF8; \ r = (((uint8_t*)src)[S_1]<< 1)& 0xF8; \
g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2); \ g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2); \
g &= 0xF8; \ g &= 0xF8; \
b = (((uint8_t*)src)[S_0]<< 3)& 0xF8; \ b = (((uint8_t*)src)[S_0]<< 3)& 0xF8; \
} while (0) } while (0)
#define ZYWRLE_SAVE_PIXEL15(dst, r, g, b) \ #define ZYWRLE_SAVE_PIXEL15(dst, r, g, b) \
do { \ do { \
r &= 0xF8; \ r &= 0xF8; \
g &= 0xF8; \ g &= 0xF8; \
b &= 0xF8; \ b &= 0xF8; \
((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6)); \ ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6)); \
((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF); \ ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF); \
} while (0) } while (0)
#define ZYWRLE_YMASK16 0xFFFFFFFC #define ZYWRLE_YMASK16 0xFFFFFFFC
#define ZYWRLE_UVMASK16 0xFFFFFFF8 #define ZYWRLE_UVMASK16 0xFFFFFFF8
#define ZYWRLE_LOAD_PIXEL16(src, r, g, b) \ #define ZYWRLE_LOAD_PIXEL16(src, r, g, b) \
do { \ do { \
r = ((uint8_t*)src)[S_1] & 0xF8; \ r = ((uint8_t*)src)[S_1] & 0xF8; \
g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3); \ g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3); \
g &= 0xFC; \ g &= 0xFC; \
b = (((uint8_t*)src)[S_0]<< 3) & 0xF8; \ b = (((uint8_t*)src)[S_0]<< 3) & 0xF8; \
} while (0) } while (0)
#define ZYWRLE_SAVE_PIXEL16(dst, r, g,b) \ #define ZYWRLE_SAVE_PIXEL16(dst, r, g,b) \
do { \ do { \
r &= 0xF8; \ r &= 0xF8; \
g &= 0xFC; \ g &= 0xFC; \
b &= 0xF8; \ b &= 0xF8; \
((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5)); \ ((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5)); \
((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF); \ ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF); \
} while (0) } while (0)
#define ZYWRLE_YMASK32 0xFFFFFFFF #define ZYWRLE_YMASK32 0xFFFFFFFF
#define ZYWRLE_UVMASK32 0xFFFFFFFF #define ZYWRLE_UVMASK32 0xFFFFFFFF
#define ZYWRLE_LOAD_PIXEL32(src, r, g, b) \ #define ZYWRLE_LOAD_PIXEL32(src, r, g, b) \
do { \ do { \
r = ((uint8_t*)src)[L_2]; \ r = ((uint8_t*)src)[L_2]; \
g = ((uint8_t*)src)[L_1]; \ g = ((uint8_t*)src)[L_1]; \
b = ((uint8_t*)src)[L_0]; \ b = ((uint8_t*)src)[L_0]; \
} while (0) } while (0)
#define ZYWRLE_SAVE_PIXEL32(dst, r, g, b) \ #define ZYWRLE_SAVE_PIXEL32(dst, r, g, b) \
do { \ do { \
((uint8_t*)dst)[L_2] = (uint8_t)r; \ ((uint8_t*)dst)[L_2] = (uint8_t)r; \
((uint8_t*)dst)[L_1] = (uint8_t)g; \ ((uint8_t*)dst)[L_1] = (uint8_t)g; \
((uint8_t*)dst)[L_0] = (uint8_t)b; \ ((uint8_t*)dst)[L_0] = (uint8_t)b; \
} while (0) } while (0)
static inline void harr(int8_t *px0, int8_t *px1) static inline void harr(int8_t *px0, int8_t *px1)
@ -443,27 +443,27 @@ static inline void filter_wavelet_square(int *buf, int width, int height,
static inline void wavelet(int *buf, int width, int height, int level) static inline void wavelet(int *buf, int width, int height, int level)
{ {
int l, s; int l, s;
int *top; int *top;
int *end; int *end;
for (l = 0; l < level; l++) { for (l = 0; l < level; l++) {
top = buf; top = buf;
end = buf + height * width; end = buf + height * width;
s = width << l; s = width << l;
while (top < end) { while (top < end) {
wavelet_level(top, width, l, 1); wavelet_level(top, width, l, 1);
top += s; top += s;
} }
top = buf; top = buf;
end = buf + width; end = buf + width;
s = 1<<l; s = 1<<l;
while (top < end) { while (top < end) {
wavelet_level(top, height, l, width); wavelet_level(top, height, l, width);
top += s; top += s;
} }
filter_wavelet_square(buf, width, height, level, l); filter_wavelet_square(buf, width, height, level, l);
} }
} }
@ -471,16 +471,16 @@ static inline void wavelet(int *buf, int width, int height, int level)
Coefficients manages as 24 bits little-endian pixel. */ Coefficients manages as 24 bits little-endian pixel. */
#define ZYWRLE_LOAD_COEFF(src, r, g, b) \ #define ZYWRLE_LOAD_COEFF(src, r, g, b) \
do { \ do { \
r = ((int8_t*)src)[2]; \ r = ((int8_t*)src)[2]; \
g = ((int8_t*)src)[1]; \ g = ((int8_t*)src)[1]; \
b = ((int8_t*)src)[0]; \ b = ((int8_t*)src)[0]; \
} while (0) } while (0)
#define ZYWRLE_SAVE_COEFF(dst, r, g, b) \ #define ZYWRLE_SAVE_COEFF(dst, r, g, b) \
do { \ do { \
((int8_t*)dst)[2] = (int8_t)r; \ ((int8_t*)dst)[2] = (int8_t)r; \
((int8_t*)dst)[1] = (int8_t)g; \ ((int8_t*)dst)[1] = (int8_t)g; \
((int8_t*)dst)[0] = (int8_t)b; \ ((int8_t*)dst)[0] = (int8_t)b; \
} while (0) } while (0)
/* /*
@ -502,22 +502,22 @@ static inline void wavelet(int *buf, int width, int height, int level)
More exact PLHarr, we reduce to odd range(-127<=x<=127). */ More exact PLHarr, we reduce to odd range(-127<=x<=127). */
#define ZYWRLE_RGBYUV_(r, g, b, y, u, v, ymask, uvmask) \ #define ZYWRLE_RGBYUV_(r, g, b, y, u, v, ymask, uvmask) \
do { \ do { \
y = (r + (g << 1) + b) >> 2; \ y = (r + (g << 1) + b) >> 2; \
u = b - g; \ u = b - g; \
v = r - g; \ v = r - g; \
y -= 128; \ y -= 128; \
u >>= 1; \ u >>= 1; \
v >>= 1; \ v >>= 1; \
y &= ymask; \ y &= ymask; \
u &= uvmask; \ u &= uvmask; \
v &= uvmask; \ v &= uvmask; \
if (y == -128) { \ if (y == -128) { \
y += (0xFFFFFFFF - ymask + 1); \ y += (0xFFFFFFFF - ymask + 1); \
} \ } \
if (u == -128) { \ if (u == -128) { \
u += (0xFFFFFFFF - uvmask + 1); \ u += (0xFFFFFFFF - uvmask + 1); \
} \ } \
if (v == -128) { \ if (v == -128) { \
v += (0xFFFFFFFF - uvmask + 1); \ v += (0xFFFFFFFF - uvmask + 1); \
} \ } \
} while (0) } while (0)