--- trunk/xvidcore/examples/xvid_encraw.c 2006/10/11 13:52:06 1729 +++ trunk/xvidcore/examples/xvid_encraw.c 2006/10/16 04:46:01 1739 @@ -21,7 +21,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid_encraw.c,v 1.28 2006-10-11 13:52:06 Skal Exp $ + * $Id: xvid_encraw.c,v 1.31 2006-10-16 04:46:01 Skal Exp $ * ****************************************************************************/ @@ -1197,6 +1197,7 @@ framestats[5].size += stats_length; } +#define SSE2PSNR(sse, width, height) ((!(sse))?0.0f : 48.131f - 10*(float)log10((float)(sse)/((float)((width)*(height))))) if (ARG_PROGRESS == 0) { printf("%5d: key=%i, time= %6.0f, len= %7d", !result ? input_num : -1, @@ -1204,17 +1205,11 @@ printf(" | type=%s, quant= %2d, len= %7d", type, stats_quant, stats_length); -#define SSE2PSNR(sse, width, height) ((!(sse))?0.0f : 48.131f - 10*(float)log10((float)(sse)/((float)((width)*(height))))) if (ARG_STATS) { printf(", psnr y = %2.2f, psnr u = %2.2f, psnr v = %2.2f", - SSE2PSNR(sse[0], XDIM, YDIM), SSE2PSNR(sse[1], XDIM / 2, - YDIM / 2), + SSE2PSNR(sse[0], XDIM, YDIM), SSE2PSNR(sse[1], XDIM / 2, YDIM / 2), SSE2PSNR(sse[2], XDIM / 2, YDIM / 2)); - - totalPSNR[0] += SSE2PSNR(sse[0], XDIM, YDIM); - totalPSNR[1] += SSE2PSNR(sse[1], XDIM/2, YDIM/2); - totalPSNR[2] += SSE2PSNR(sse[2], XDIM/2, YDIM/2); } printf("\n"); } else { @@ -1231,8 +1226,13 @@ } } - } + if (ARG_STATS) { + totalPSNR[0] += SSE2PSNR(sse[0], XDIM, YDIM); + totalPSNR[1] += SSE2PSNR(sse[1], XDIM/2, YDIM/2); + totalPSNR[2] += SSE2PSNR(sse[2], XDIM/2, YDIM/2); + } #undef SSE2PSNR + } if (m4v_size < 0) break; @@ -1903,16 +1903,14 @@ xvid_enc_create.num_plugins++; } -#ifndef WIN32 - if (ARG_SSIM) { + if (ARG_SSIM || ARG_SSIM_PATH != NULL) { plugins[xvid_enc_create.num_plugins].func = xvid_plugin_ssim; - ssim.b_printstat = 1; + ssim.b_printstat = ARG_SSIM; ssim.stat_path = ARG_SSIM_PATH; ssim.b_visualize = 0; plugins[xvid_enc_create.num_plugins].param = &ssim; xvid_enc_create.num_plugins++; } -#endif #if 0 if (ARG_DEBUG) {