[cvs] / xvidcore / src / plugins / plugin_psnr.c Repository:
ViewVC logotype

Diff of /xvidcore/src/plugins/plugin_psnr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1, Sat Mar 15 14:38:34 2003 UTC revision 1.1.2.5, Wed Oct 1 23:23:01 2003 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - XviD plugin: outputs PSNR to stdout (should disapear soon)  -
5     *
6     *  Copyright(C) 2003 Peter Ross <pross@xvid.org>
7     *
8     *  This program is free software ; you can redistribute it and/or modify
9     *  it under the terms of the GNU General Public License as published by
10     *  the Free Software Foundation ; either version 2 of the License, or
11     *  (at your option) any later version.
12     *
13     *  This program is distributed in the hope that it will be useful,
14     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
15     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     *  GNU General Public License for more details.
17     *
18     *  You should have received a copy of the GNU General Public License
19     *  along with this program ; if not, write to the Free Software
20     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21     *
22     * $Id$
23     *
24     ****************************************************************************/
25    
26    #include <stdio.h>
27    
28  #include "../xvid.h"  #include "../xvid.h"
29  #include "../image/image.h"  #include "../image/image.h"
30    
# Line 9  Line 36 
36      case XVID_PLG_INFO :      case XVID_PLG_INFO :
37          {          {
38          xvid_plg_info_t * info = (xvid_plg_info_t*)param1;          xvid_plg_info_t * info = (xvid_plg_info_t*)param1;
39          info->flags = XVID_REQORIGINAL;          info->flags = XVID_REQPSNR;
40          return 0;          return 0;
41          }          }
42    
# Line 22  Line 49 
49         {         {
50         xvid_plg_data_t * data = (xvid_plg_data_t*)param1;         xvid_plg_data_t * data = (xvid_plg_data_t*)param1;
51    
        long sse_y = plane_sse(data->original.plane[0], data->current.plane[0],  
                 data->current.stride[0], data->width, data->height);  
   
        long sse_u = plane_sse(data->original.plane[1], data->current.plane[1],  
                 data->current.stride[1], data->width/2, data->height/2);  
   
        long sse_v = plane_sse(data->original.plane[2], data->current.plane[2],  
                 data->current.stride[2], data->width/2, data->height/2);  
   
52         printf("y_psnr=%2.2f u_psnr=%2.2f v_psnr=%2.2f\n",         printf("y_psnr=%2.2f u_psnr=%2.2f v_psnr=%2.2f\n",
53             sse_to_PSNR(sse_y, data->width*data->height),             sse_to_PSNR(data->sse_y, data->width*data->height),
54             sse_to_PSNR(sse_u, data->width*data->height/4),             sse_to_PSNR(data->sse_u, data->width*data->height/4),
55             sse_to_PSNR(sse_v, data->width*data->height/4));             sse_to_PSNR(data->sse_v, data->width*data->height/4));
   
        {  
            IMAGE img;  
            char tmp[100];  
            img.y = data->original.plane[0];  
            img.u = data->original.plane[1];  
            img.v = data->original.plane[2];  
            sprintf(tmp, "ori-%03i.pgm", data->frame_num);  
            image_dump_yuvpgm(&img, data->original.stride[0], data->width, data->height, tmp);  
   
            img.y = data->current.plane[0];  
            img.u = data->current.plane[1];  
            img.v = data->current.plane[2];  
            sprintf(tmp, "enc-%03i.pgm", data->frame_num);  
            image_dump_yuvpgm(&img, data->reference.stride[0], data->width, data->height, tmp);  
        }  
56    
57         return 0;         return 0;
58         }         }

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.5

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4