[svn] / branches / dev-api-4 / xvidcore / src / plugins / plugin_psnr.c Repository:
ViewVC logotype

Annotation of /branches/dev-api-4/xvidcore/src/plugins/plugin_psnr.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 921 - (view) (download)

1 : suxen_drol 921 #include "../xvid.h"
2 :     #include "../image/image.h"
3 :    
4 :    
5 :     int xvid_plugin_psnr(void * handle, int opt, void * param1, void * param2)
6 :     {
7 :     switch(opt)
8 :     {
9 :     case XVID_PLG_INFO :
10 :     {
11 :     xvid_plg_info_t * info = (xvid_plg_info_t*)param1;
12 :     info->flags = XVID_REQORIGINAL;
13 :     return 0;
14 :     }
15 :    
16 :     case XVID_PLG_CREATE :
17 :     case XVID_PLG_DESTROY :
18 :     case XVID_PLG_BEFORE :
19 :     return 0;
20 :    
21 :     case XVID_PLG_AFTER :
22 :     {
23 :     xvid_plg_data_t * data = (xvid_plg_data_t*)param1;
24 :    
25 :     long sse_y = plane_sse(data->original.plane[0], data->current.plane[0],
26 :     data->current.stride[0], data->width, data->height);
27 :    
28 :     long sse_u = plane_sse(data->original.plane[1], data->current.plane[1],
29 :     data->current.stride[1], data->width/2, data->height/2);
30 :    
31 :     long sse_v = plane_sse(data->original.plane[2], data->current.plane[2],
32 :     data->current.stride[2], data->width/2, data->height/2);
33 :    
34 :     printf("y_psnr=%2.2f u_psnr=%2.2f v_psnr=%2.2f\n",
35 :     sse_to_PSNR(sse_y, data->width*data->height),
36 :     sse_to_PSNR(sse_u, data->width*data->height/4),
37 :     sse_to_PSNR(sse_v, data->width*data->height/4));
38 :    
39 :     {
40 :     IMAGE img;
41 :     char tmp[100];
42 :     img.y = data->original.plane[0];
43 :     img.u = data->original.plane[1];
44 :     img.v = data->original.plane[2];
45 :     sprintf(tmp, "ori-%03i.pgm", data->frame_num);
46 :     image_dump_yuvpgm(&img, data->original.stride[0], data->width, data->height, tmp);
47 :    
48 :     img.y = data->current.plane[0];
49 :     img.u = data->current.plane[1];
50 :     img.v = data->current.plane[2];
51 :     sprintf(tmp, "enc-%03i.pgm", data->frame_num);
52 :     image_dump_yuvpgm(&img, data->reference.stride[0], data->width, data->height, tmp);
53 :     }
54 :    
55 :     return 0;
56 :     }
57 :     }
58 :    
59 :     return XVID_ERR_FAIL;
60 :     }

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