--- image.c 2003/01/11 14:59:24 1.20.2.15 +++ image.c 2003/01/26 05:09:00 1.20.2.18 @@ -938,6 +938,36 @@ return psnr_y; } + +float sse_to_PSNR(long sse, int pixels) +{ + if (sse==0) + return 99.99F; + + return 48.131F - 10*(float)log10((float)sse/(float)(pixels)); // log10(255*255)=4.8131 + +} + +long plane_sse(uint8_t * orig, + uint8_t * recon, + uint16_t stride, + uint16_t width, + uint16_t height) +{ + int diff, x, y; + long sse=0; + + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + diff = *(orig + x) - *(recon + x); + sse += diff * diff; + } + orig += stride; + recon += stride; + } + return sse; +} + /* #include