diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-12-04 21:13:02 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-12-04 21:13:02 +0000 |
commit | 140cb66321f2d3271d4e1a9c80eee42e0500c4fa (patch) | |
tree | 46fac4ba73ad79302383b7c8b8ae25b3d665a2cb /libavcodec/dsputil.c | |
parent | 5b20b7328a6b0d0286b6d0f1975fbd417ae010eb (diff) | |
download | ffmpeg-140cb66321f2d3271d4e1a9c80eee42e0500c4fa.tar.gz |
new PSNR code (now works with chroma, b frames, ...)
rename *_TYPE to FF_*_TYPE for the external API
allow user specified pict_type
Originally committed as revision 1308 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 9039d2625f..1e177116a4 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1528,37 +1528,3 @@ void avcodec_set_bit_exact(void) // dsputil_set_bit_exact_mmx(); #endif } - -void get_psnr(UINT8 *orig_image[3], UINT8 *coded_image[3], - int orig_linesize[3], int coded_linesize, - AVCodecContext *avctx) -{ - int quad, diff, x, y; - UINT8 *orig, *coded; - UINT32 *sq = squareTbl + 256; - - quad = 0; - diff = 0; - - /* Luminance */ - orig = orig_image[0]; - coded = coded_image[0]; - - for (y=0;y<avctx->height;y++) { - for (x=0;x<avctx->width;x++) { - diff = *(orig + x) - *(coded + x); - quad += sq[diff]; - } - orig += orig_linesize[0]; - coded += coded_linesize; - } - - avctx->psnr_y = (float) quad / (float) (avctx->width * avctx->height); - - if (avctx->psnr_y) { - avctx->psnr_y = (float) (255 * 255) / avctx->psnr_y; - avctx->psnr_y = 10 * (float) log10 (avctx->psnr_y); - } else - avctx->psnr_y = 99.99; -} - |