void DoWebpTest2(L_REGPARAMS  *rp,
                 const char   *fname,
                 l_int32       quality,
                 l_int32       lossless,
                 l_float32     expected,
                 l_float32     delta)
{
char       buf[256];
l_float32  psnr;
PIX       *pixs, *pix1;

    pixs = pixRead(fname);
    snprintf(buf, sizeof(buf), "/tmp/lept/webp/webpio.%d.webp", rp->index + 1);
    if (lossless) startTimer();
    pixWriteWebP("/tmp/lept/webp/junk.webp", pixs, quality, lossless);
    if (lossless) fprintf(stderr, "Lossless write: %7.3f sec\n", stopTimer());
    pix1 = pixRead("/tmp/lept/webp/junk.webp");
    pixGetPSNR(pixs, pix1, 4, &psnr);
    if (lossless)
        fprintf(stderr, "lossless; psnr should be 1000: psnr = %7.3f\n", psnr);
    else
        fprintf(stderr, "qual = %d, psnr = %7.3f\n", quality, psnr);
    regTestCompareValues(rp, expected, psnr, delta);
    pixDestroy(&pixs);
    pixDestroy(&pix1);
    return;
}
Beispiel #2
0
void DoWebpTest2(L_REGPARAMS  *rp,
                 const char   *fname,
                 l_int32       quality,
                 l_float32     expected,
                 l_float32     delta)
{
char       buf[256];
l_float32  psnr;
PIX       *pixs, *pix1;

    pixs = pixRead(fname);
    snprintf(buf, sizeof(buf), "/tmp/webpio.%d.webp", rp->index + 1);
    pixWriteWebP("/tmp/junk.webp", pixs, quality);
    pix1 = pixRead("/tmp/junk.webp");
    pixGetPSNR(pixs, pix1, 4, &psnr);
    fprintf(stderr, "qual = %d, psnr = %7.3f\n", quality, psnr);
    regTestCompareValues(rp, expected, psnr, delta);
    pixDestroy(&pixs);
    pixDestroy(&pix1);
    return;
}