tight_detect_smooth_image(VncState *vs, int w, int h)

{

    uint errors;

    int compression = vs->tight.compression;

    int quality = vs->tight.quality;



    if (!vs->vd->lossy) {

        return 0;

    }



    if (ds_get_bytes_per_pixel(vs->ds) == 1 ||

        vs->clientds.pf.bytes_per_pixel == 1 ||

        w < VNC_TIGHT_DETECT_MIN_WIDTH || h < VNC_TIGHT_DETECT_MIN_HEIGHT) {

        return 0;

    }



    if (vs->tight.quality != -1) {

        if (w * h < VNC_TIGHT_JPEG_MIN_RECT_SIZE) {

            return 0;

        }

    } else {

        if (w * h < tight_conf[compression].gradient_min_rect_size) {

            return 0;

        }

    }



    if (vs->clientds.pf.bytes_per_pixel == 4) {

        if (vs->tight.pixel24) {

            errors = tight_detect_smooth_image24(vs, w, h);

            if (vs->tight.quality != -1) {

                return (errors < tight_conf[quality].jpeg_threshold24);

            }

            return (errors < tight_conf[compression].gradient_threshold24);

        } else {

            errors = tight_detect_smooth_image32(vs, w, h);

        }

    } else {

        errors = tight_detect_smooth_image16(vs, w, h);

    }

    if (quality != -1) {

        return (errors < tight_conf[quality].jpeg_threshold);

    }

    return (errors < tight_conf[compression].gradient_threshold);

}

tight_detect_smooth_image(VncState *vs, int w, int h)

{

    uint errors;

    int compression = vs->tight.compression;

    int quality = vs->tight.quality;



    if (!vs->vd->lossy) {

        return 0;

    }



    if (ds_get_bytes_per_pixel(vs->ds) == 1 ||

        vs->clientds.pf.bytes_per_pixel == 1 ||

        w < VNC_TIGHT_DETECT_MIN_WIDTH || h < VNC_TIGHT_DETECT_MIN_HEIGHT) {

        return 0;

    }



    if (vs->tight.quality != -1) {

        if (w * h < VNC_TIGHT_JPEG_MIN_RECT_SIZE) {

            return 0;

        }

    } else {

        if (w * h < tight_conf[compression].gradient_min_rect_size) {

            return 0;

        }

    }



    if (vs->clientds.pf.bytes_per_pixel == 4) {

        if (vs->tight.pixel24) {

            errors = tight_detect_smooth_image24(vs, w, h);

            if (vs->tight.quality != -1) {

                return (errors < tight_conf[quality].jpeg_threshold24);

            }

            return (errors < tight_conf[compression].gradient_threshold24);

        } else {

            errors = tight_detect_smooth_image32(vs, w, h);

        }

    } else {

        errors = tight_detect_smooth_image16(vs, w, h);

    }

    if (quality != -1) {

        return (errors < tight_conf[quality].jpeg_threshold);

    }

    return (errors < tight_conf[compression].gradient_threshold);

}

FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2)

{

    uint errors;

    int VAR_3 = VAR_0->tight.VAR_3;

    int VAR_4 = VAR_0->tight.VAR_4;



    if (!VAR_0->vd->lossy) {

        return 0;

    }



    if (ds_get_bytes_per_pixel(VAR_0->ds) == 1 ||

        VAR_0->clientds.pf.bytes_per_pixel == 1 ||

        VAR_1 < VNC_TIGHT_DETECT_MIN_WIDTH || VAR_2 < VNC_TIGHT_DETECT_MIN_HEIGHT) {

        return 0;

    }



    if (VAR_0->tight.VAR_4 != -1) {

        if (VAR_1 * VAR_2 < VNC_TIGHT_JPEG_MIN_RECT_SIZE) {

            return 0;

        }

    } else {

        if (VAR_1 * VAR_2 < tight_conf[VAR_3].gradient_min_rect_size) {

            return 0;

        }

    }



    if (VAR_0->clientds.pf.bytes_per_pixel == 4) {

        if (VAR_0->tight.pixel24) {

            errors = tight_detect_smooth_image24(VAR_0, VAR_1, VAR_2);

            if (VAR_0->tight.VAR_4 != -1) {

                return (errors < tight_conf[VAR_4].jpeg_threshold24);

            }

            return (errors < tight_conf[VAR_3].gradient_threshold24);

        } else {

            errors = tight_detect_smooth_image32(VAR_0, VAR_1, VAR_2);

        }

    } else {

        errors = tight_detect_smooth_image16(VAR_0, VAR_1, VAR_2);

    }

    if (VAR_4 != -1) {

        return (errors < tight_conf[VAR_4].jpeg_threshold);

    }

    return (errors < tight_conf[VAR_3].gradient_threshold);

}

FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2)
{ uint errors; int VAR_3 = VAR_0->tight.VAR_3; int VAR_4 = VAR_0->tight.VAR_4; if (!VAR_0->vd->lossy) { return 0; } if (ds_get_bytes_per_pixel(VAR_0->ds) == 1 ||
VAR_0->clientds.pf.bytes_per_pixel == 1 ||
VAR_1 < VNC_TIGHT_DETECT_MIN_WIDTH || VAR_2 < VNC_TIGHT_DETECT_MIN_HEIGHT) { return 0; } if (VAR_0->tight.VAR_4 != -1) { if (VAR_1 * VAR_2 < VNC_TIGHT_JPEG_MIN_RECT_SIZE) { return 0; } } else { if (VAR_1 * VAR_2 < tight_conf[VAR_3].gradient_min_rect_size) { return 0; } } if (VAR_0->clientds.pf.bytes_per_pixel == 4) { if (VAR_0->tight.pixel24) { errors = tight_detect_smooth_image24(VAR_0, VAR_1, VAR_2); if (VAR_0->tight.VAR_4 != -1) { return (errors < tight_conf[VAR_4].jpeg_threshold24); } return (errors < tight_conf[VAR_3].gradient_threshold24); } else { errors = tight_detect_smooth_image32(VAR_0, VAR_1, VAR_2); } } else { errors = tight_detect_smooth_image16(VAR_0, VAR_1, VAR_2); } if (VAR_4 != -1) { return (errors < tight_conf[VAR_4].jpeg_threshold); } return (errors < tight_conf[VAR_3].gradient_threshold); }