Evaluate Video Quality
来源:互联网 发布:淘宝店童装货源 编辑:程序博客网 时间:2024/05/23 13:03
How to evaluate video?
PSNR and SSIM.
PSNR is easy to calculate:
http://blog.csdn.net/c602273091/article/details/49861817
SSIM is more relevant to eye visibility.
How to calculate them?
Using Evalvid.
http://www2.tkn.tu-berlin.de/research/evalvid/
http://download.csdn.net/detail/leixiaohua1020/6374037
Run in cmd or using batching processing.
psnr.exe 1920 1080 420 src.yuv des.yuv > psnr.txt
MSU Video Quality Measurement Tool
http://www.compression.ru/video/quality_measure/video_measurement_tool_en.html
Source Code
From the code below, we can learn how to calculate ssim and psnr and some skills about VS.
Python Version will be displayed in next blog.
#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#ifdef _WIN32 #include "stdint_w32.h" #define alloca _alloca#else #include <stdint.h>#endif/**************************************************************************** * structural similarity metric [from x264] ****************************************************************************/#define x264_alloca(x) (void*)(((intptr_t)alloca((x)+15)+15)&~15)#define XCHG(type,a,b) { type t = a; a = b; b = t; }#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )static void ssim_4x4x2_core( const uint8_t *pix1, int stride1, const uint8_t *pix2, int stride2, int sums[2][4]){ int x, y, z; for(z=0; z<2; z++) { uint32_t s1=0, s2=0, ss=0, s12=0; for(y=0; y<4; y++) for(x=0; x<4; x++) { int a = pix1[x+y*stride1]; int b = pix2[x+y*stride2]; s1 += a; s2 += b; ss += a*a; ss += b*b; s12 += a*b; } sums[z][0] = s1; sums[z][1] = s2; sums[z][2] = ss; sums[z][3] = s12; pix1 += 4; pix2 += 4; }}static float ssim_end1( int s1, int s2, int ss, int s12 ){ static const int ssim_c1 = (int)(.01*.01*255*255*64 + .5); static const int ssim_c2 = (int)(.03*.03*255*255*64*63 + .5); int vars = ss*64 - s1*s1 - s2*s2; int covar = s12*64 - s1*s2; return (float)(2*s1*s2 + ssim_c1) * (float)(2*covar + ssim_c2)\ / ((float)(s1*s1 + s2*s2 + ssim_c1) * (float)(vars + ssim_c2));}static float ssim_end4( int sum0[5][4], int sum1[5][4], int width ){ int i; float ssim = 0.0; for( i = 0; i < width; i++ ) ssim += ssim_end1( sum0[i][0] + sum0[i+1][0] + sum1[i][0] + sum1[i+1][0], sum0[i][1] + sum0[i+1][1] + sum1[i][1] + sum1[i+1][1], sum0[i][2] + sum0[i+1][2] + sum1[i][2] + sum1[i+1][2], sum0[i][3] + sum0[i+1][3] + sum1[i][3] + sum1[i+1][3] ); return ssim;}float x264_pixel_ssim_wxh(uint8_t *pix1, int stride1, uint8_t *pix2, int stride2, int width, int height ){ int x, y, z; float ssim = 0.0; int (*sum0)[4] = x264_alloca(4 * (width/4+3) * sizeof(int)); int (*sum1)[4] = x264_alloca(4 * (width/4+3) * sizeof(int)); width >>= 2; height >>= 2; z = 0; for( y = 1; y < height; y++ ) { for( ; z <= y; z++ ) { XCHG( void*, sum0, sum1 ); for( x = 0; x < width; x+=2 ) ssim_4x4x2_core( &pix1[4*(x+z*stride1)], stride1, &pix2[4*(x+z*stride2)], stride2, &sum0[x] ); } for( x = 0; x < width-1; x += 4 ) ssim += ssim_end4( sum0+x, sum1+x, X264_MIN(4,width-x-1) ); } return ssim / ((width-1) * (height-1));}int main(int n, char *cl[]){ FILE *f1, *f2; int ssim = 0, i, x, y, yuv, inc = 1, size = 0, N = 0, Y, F; double yrmse, diff, mean = 0, stdv = 0, *ypsnr = 0; unsigned char *b1, *b2; clock_t t = clock(); if (n != 6 && n != 7) { puts("psnr x y <YUV format> <src.yuv> <dst.yuv> [multiplex] [ssim]"); puts(" x\t\tframe width"); puts(" y\t\tframe height"); puts(" YUV format\t420, 422, etc."); puts(" src.yuv\tsource video"); puts(" dst.yuv\tdistorted video"); puts(" [multiplex]\toptional"); puts(" [ssim]\toptional: calculate structural similarity instead of PSNR"); return EXIT_FAILURE; } if ((f1 = fopen(cl[4], "rb")) == 0) goto A; if ((f2 = fopen(cl[5], "rb")) == 0) goto B; if (!(x = strtoul(cl[1], 0, 10)) || !(y = strtoul(cl[2], 0, 10))) goto C; if ((yuv = strtoul(cl[3], 0, 10)) > 444) goto D; if (cl[6] && !strcmp(cl[6], "multiplex")) inc = 2; if (cl[6] && !strcmp(cl[6], "ssim")) ssim = 1; Y = x * y; switch (yuv) { case 400: F = Y; break; case 422: F = Y * 2; break; case 444: F = Y * 3; break; default : case 420: F = Y * 3 / 2; break; } if (!(b1 = malloc(F))) goto E; if (!(b2 = malloc(F))) goto E; for (;;) { if (1 != fread(b1, F, 1, f1) || 1 != fread(b2, F, 1, f2)) break; if (++N > size) { size += 0xffff; if (!(ypsnr = realloc(ypsnr, size * sizeof *ypsnr))) goto E; } if (ssim) { mean += ypsnr[N - 1] = x264_pixel_ssim_wxh(b1, x, b2, x, x, y); } else { for (yrmse = 0, i = inc - 1; i < (inc == 1 ? Y : F); i += inc) { diff = b1[i] - b2[i]; yrmse += diff * diff; } mean += ypsnr[N - 1] = yrmse ? 20 * (log10(255 / sqrt(yrmse / Y))) : 0; } printf("%.3f\n", ypsnr[N - 1]); } if (N) { mean /= N; for (stdv = 0, i = 0; i < N; i++) { diff = ypsnr[i] - mean; stdv += diff * diff; } stdv = sqrt(stdv / (N - 1)); free(ypsnr); } fclose(f1); fclose(f2); fprintf(stderr, "%s:\t%d frames (CPU: %lu s) mean: %.2f stdv: %.2f\n", ssim ? "ssim" : "psnr", N, (unsigned long) ((clock() - t) / CLOCKS_PER_SEC), mean, stdv); return 0; A: fprintf(stderr, " Error opening source video file.\n"); goto X; B: fprintf(stderr, " Error opening decoded video file.\n"); goto X; C: fprintf(stderr, " Invalid width or height.\n"); goto X; D: fprintf(stderr, " Invalid YUV format.\n"); goto X; E: fprintf(stderr, " Not enough memory.\n"); X: return EXIT_FAILURE;}
Standard of Video Evaluation
http://download.csdn.net/detail/leixiaohua1020/6423425
Conclusion of Evaluation Method
PeakSignal to Noise Ratio(PSNR)
Ref to my ex-blog.
noise quality measure (NQM) index
Ref:N. Damera-Venkata, T.D. Kite, W.S. Geisler, B.L. Evans, and A.C.Bovik, “Image quality assessment based on a degradation model,” IEEE Trans. IP,vol. 9, pp. 636-650, 2000.
universal quality index (UQI)
Ref:Z. Wang and A.C. Bovik, “A universal image quality index,” IEEE SignalProcess. Lett., vol. 9, pp. 81-84, 2002.
structural similarity (SSIM) index
Ref:Z. Wang, A.C. Bovik, H.R. Sheikh, and E.P. Simoncelli,”Image qualityassessment: from error visibility to structural similarity,” IEEE Trans. IP,vol. 13, pp. 600-612, 2004.
multi-scaleSSIM (MS-SSIM) index
Ref:Z. Wang, E.P. Simoncelli, and A.C. Bovik, “Multi-scale structuralsimilarity for image quality assessment,” ACSSC’03, pp. 1398-1402, 2003.
information fidelity criterion (IFC) index
Ref:H.R. Sheikh, A.C. Bovik, and G. de Veciana, “An information fidelitycriterion for image quality assessment using natural scene statistics,” IEEETrans. IP, vol. 14, pp. 2117-2128, 2005.
visual information fidelity (VIF) index
Ref:H.R. Sheikh and A.C. Bovik, “Image information and visual quality,”IEEE Trans. IP, vol. 15, pp. 430-444, 2006.
visual signal to noise ratio (VSNR) index
Ref:D.M. Chandler and S.S. Hemami, “VSNR: a wavelet-based visualsignal-to-noise ratio for natural images,” IEEE Trans. IP, vol. 16, pp.2284-2298, 2007.
information content weighted SSIM (IW-SSIM) index
Ref:Z. Wang and Q. Li, “Information content weighting for perceptualimage quality assessment,” IEEE Trans. IP, vol. 20,
pp. 1185-1198, 2011.
Riesz transforms based feature similarity (RFSIM) index
Ref:L. Zhang, L. Zhang, and X. Mou, “RFSIM: a feature based imagequality assessment metric using Riesz transforms,” ICIP’10, pp. 321-324, 2010.
feature similarity (FSIM) index
Ref:L. Zhang, L. Zhang, X. Mou, and D. Zhang, “FSIM: a feature similarityindex for image quality assessment,” IEEE Trans. IP, vol. 20, pp. 2378-2386,2011.
All of the method above comes from ——
A COMPREHENSIVEEVALUATION OF FULL REFERENCE IMAGE QUALITY ASSESSMENT ALGORITHMS
http://blog.csdn.net/leixiaohua1020/article/details/38324973
http://blog.csdn.net/leixiaohua1020/article/details/12858773
- Evaluate Video Quality
- some problems in video quality detect
- No Reference Image and Video Quality Assessment
- 数字视频质量评价 Video-Quality Metric
- 视频客观质量评价工具:MSU Video Quality Measurement Tool
- 视频主观质量评价工具:MSU Perceptual Video Quality tool
- Android CTS Verifier bug - Streaming Video Quality Verifier
- 视频主观质量评价工具:MSU Perceptual Video Quality tool
- Quality
- [Sigcom13]Developing a Predictive Model ofQuality of Experience for Internet Video
- H.264/MPEG-4:高质量视频数据流传播的视频多媒体数字信号编解码器(Video CODEC For High Quality Video Str
- video
- Video
- video
- Video
- video
- Quality & Technology
- 函数Evaluate
- 黑马程序员——网络编程(二)
- 实例讲解如何利用jQuery设置图片居中放大或者缩小
- 凸优化--强弱对偶性的几何解释
- [leetcode 249] Group Shifted Strings
- java集合框架集合框架是为表示和操作集合而规定的一种统一的标准的体系结构。任何集合框架都包含三大块内容:对外的接口、接口的实现和对集合运算的算法。
- Evaluate Video Quality
- 拷贝项目文件夹中的文件存放到本地
- ViewPager实现多页面滑动
- Java项目在jsp页面中引入jquery框架的步骤
- easyui datebox 默认当天日期
- PowerDesigner之PDM(物理概念模型)
- Win7的任务计划怎么是后台运行的,怎么设置能让任务前台运行?
- 如何给DateTime类型赋空值
- JQuery 学习总结及实例