| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 { | 2263 { |
| 2264 FILE *f = fopen("opsnr.stt", "a"); | 2264 FILE *f = fopen("opsnr.stt", "a"); |
| 2265 double time_encoded = (cpi->last_end_time_stamp_seen | 2265 double time_encoded = (cpi->last_end_time_stamp_seen |
| 2266 - cpi->first_time_stamp_ever) / 10000000.000; | 2266 - cpi->first_time_stamp_ever) / 10000000.000; |
| 2267 double total_encode_time = (cpi->time_receive_data + | 2267 double total_encode_time = (cpi->time_receive_data + |
| 2268 cpi->time_compress_data) / 1000.000; | 2268 cpi->time_compress_data) / 1000.000; |
| 2269 double dr = (double)cpi->bytes * 8.0 / 1000.0 / time_encoded; | 2269 double dr = (double)cpi->bytes * 8.0 / 1000.0 / time_encoded; |
| 2270 | 2270 |
| 2271 if (cpi->b_calculate_psnr) | 2271 if (cpi->b_calculate_psnr) |
| 2272 { | 2272 { |
| 2273 YV12_BUFFER_CONFIG *lst_yv12 = | |
| 2274 &cpi->common.yv12_fb[cpi->common.lst_fb_idx]; | |
| 2275 | |
| 2276 if (cpi->oxcf.number_of_layers > 1) | 2273 if (cpi->oxcf.number_of_layers > 1) |
| 2277 { | 2274 { |
| 2278 int i; | 2275 int i; |
| 2279 | 2276 |
| 2280 fprintf(f, "Layer\tBitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t" | 2277 fprintf(f, "Layer\tBitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t" |
| 2281 "GLPsnrP\tVPXSSIM\t\n"); | 2278 "GLPsnrP\tVPXSSIM\t\n"); |
| 2282 for (i=0; i<(int)cpi->oxcf.number_of_layers; i++) | 2279 for (i=0; i<(int)cpi->oxcf.number_of_layers; i++) |
| 2283 { | 2280 { |
| 2284 double dr = (double)cpi->bytes_in_layer[i] * | 2281 double dr = (double)cpi->bytes_in_layer[i] * |
| 2285 8.0 / 1000.0 / time_encoded; | 2282 8.0 / 1000.0 / time_encoded; |
| 2286 double samples = 3.0 / 2 * cpi->frames_in_layer[i] * | 2283 double samples = 3.0 / 2 * cpi->frames_in_layer[i] * |
| 2287 lst_yv12->y_width * lst_yv12->y_height; | 2284 cpi->common.Width * cpi->common.Height; |
| 2288 double total_psnr = | 2285 double total_psnr = |
| 2289 vpx_sse_to_psnr(samples, 255.0, | 2286 vpx_sse_to_psnr(samples, 255.0, |
| 2290 cpi->total_error2[i]); | 2287 cpi->total_error2[i]); |
| 2291 double total_psnr2 = | 2288 double total_psnr2 = |
| 2292 vpx_sse_to_psnr(samples, 255.0, | 2289 vpx_sse_to_psnr(samples, 255.0, |
| 2293 cpi->total_error2_p[i]); | 2290 cpi->total_error2_p[i]); |
| 2294 double total_ssim = 100 * pow(cpi->sum_ssim[i] / | 2291 double total_ssim = 100 * pow(cpi->sum_ssim[i] / |
| 2295 cpi->sum_weights[i], 8.0); | 2292 cpi->sum_weights[i], 8.0); |
| 2296 | 2293 |
| 2297 fprintf(f, "%5d\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t" | 2294 fprintf(f, "%5d\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t" |
| 2298 "%7.3f\t%7.3f\n", | 2295 "%7.3f\t%7.3f\n", |
| 2299 i, dr, | 2296 i, dr, |
| 2300 cpi->sum_psnr[i] / cpi->frames_in_layer[i], | 2297 cpi->sum_psnr[i] / cpi->frames_in_layer[i], |
| 2301 total_psnr, | 2298 total_psnr, |
| 2302 cpi->sum_psnr_p[i] / cpi->frames_in_layer[i], | 2299 cpi->sum_psnr_p[i] / cpi->frames_in_layer[i], |
| 2303 total_psnr2, total_ssim); | 2300 total_psnr2, total_ssim); |
| 2304 } | 2301 } |
| 2305 } | 2302 } |
| 2306 else | 2303 else |
| 2307 { | 2304 { |
| 2308 double samples = 3.0 / 2 * cpi->count * | 2305 double samples = 3.0 / 2 * cpi->count * |
| 2309 lst_yv12->y_width * lst_yv12->y_height; | 2306 cpi->common.Width * cpi->common.Height; |
| 2310 double total_psnr = vpx_sse_to_psnr(samples, 255.0, | 2307 double total_psnr = vpx_sse_to_psnr(samples, 255.0, |
| 2311 cpi->total_sq_error); | 2308 cpi->total_sq_error); |
| 2312 double total_psnr2 = vpx_sse_to_psnr(samples, 255.0, | 2309 double total_psnr2 = vpx_sse_to_psnr(samples, 255.0, |
| 2313 cpi->total_sq_error2); | 2310 cpi->total_sq_error2); |
| 2314 double total_ssim = 100 * pow(cpi->summed_quality / | 2311 double total_ssim = 100 * pow(cpi->summed_quality / |
| 2315 cpi->summed_weights, 8.0); | 2312 cpi->summed_weights, 8.0); |
| 2316 | 2313 |
| 2317 fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t" | 2314 fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t" |
| 2318 "GLPsnrP\tVPXSSIM\t Time(us)\n"); | 2315 "GLPsnrP\tVPXSSIM\t Time(us)\n"); |
| 2319 fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t" | 2316 fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t" |
| (...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5666 { | 5663 { |
| 5667 cpi->common.show_frame_mi = cpi->common.mi; | 5664 cpi->common.show_frame_mi = cpi->common.mi; |
| 5668 cpi->count ++; | 5665 cpi->count ++; |
| 5669 | 5666 |
| 5670 if (cpi->b_calculate_psnr) | 5667 if (cpi->b_calculate_psnr) |
| 5671 { | 5668 { |
| 5672 uint64_t ye,ue,ve; | 5669 uint64_t ye,ue,ve; |
| 5673 double frame_psnr; | 5670 double frame_psnr; |
| 5674 YV12_BUFFER_CONFIG *orig = cpi->Source; | 5671 YV12_BUFFER_CONFIG *orig = cpi->Source; |
| 5675 YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show; | 5672 YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show; |
| 5676 int y_samples = orig->y_height * orig->y_width ; | 5673 unsigned int y_width = cpi->common.Width; |
| 5677 int uv_samples = orig->uv_height * orig->uv_width ; | 5674 unsigned int y_height = cpi->common.Height; |
| 5675 unsigned int uv_width = (y_width + 1) / 2; |
| 5676 unsigned int uv_height = (y_height + 1) / 2; |
| 5677 int y_samples = y_height * y_width; |
| 5678 int uv_samples = uv_height * uv_width; |
| 5678 int t_samples = y_samples + 2 * uv_samples; | 5679 int t_samples = y_samples + 2 * uv_samples; |
| 5679 double sq_error; | 5680 double sq_error; |
| 5680 | 5681 |
| 5681 ye = calc_plane_error(orig->y_buffer, orig->y_stride, | 5682 ye = calc_plane_error(orig->y_buffer, orig->y_stride, |
| 5682 recon->y_buffer, recon->y_stride, orig->y_width, orig->y_heigh
t); | 5683 recon->y_buffer, recon->y_stride, y_width, y_height); |
| 5683 | 5684 |
| 5684 ue = calc_plane_error(orig->u_buffer, orig->uv_stride, | 5685 ue = calc_plane_error(orig->u_buffer, orig->uv_stride, |
| 5685 recon->u_buffer, recon->uv_stride, orig->uv_width, orig->uv_he
ight); | 5686 recon->u_buffer, recon->uv_stride, uv_width, uv_height); |
| 5686 | 5687 |
| 5687 ve = calc_plane_error(orig->v_buffer, orig->uv_stride, | 5688 ve = calc_plane_error(orig->v_buffer, orig->uv_stride, |
| 5688 recon->v_buffer, recon->uv_stride, orig->uv_width, orig->uv_he
ight); | 5689 recon->v_buffer, recon->uv_stride, uv_width, uv_height); |
| 5689 | 5690 |
| 5690 sq_error = (double)(ye + ue + ve); | 5691 sq_error = (double)(ye + ue + ve); |
| 5691 | 5692 |
| 5692 frame_psnr = vpx_sse_to_psnr(t_samples, 255.0, sq_error); | 5693 frame_psnr = vpx_sse_to_psnr(t_samples, 255.0, sq_error); |
| 5693 | 5694 |
| 5694 cpi->total_y += vpx_sse_to_psnr(y_samples, 255.0, (double)ye); | 5695 cpi->total_y += vpx_sse_to_psnr(y_samples, 255.0, (double)ye); |
| 5695 cpi->total_u += vpx_sse_to_psnr(uv_samples, 255.0, (double)ue); | 5696 cpi->total_u += vpx_sse_to_psnr(uv_samples, 255.0, (double)ue); |
| 5696 cpi->total_v += vpx_sse_to_psnr(uv_samples, 255.0, (double)ve); | 5697 cpi->total_v += vpx_sse_to_psnr(uv_samples, 255.0, (double)ve); |
| 5697 cpi->total_sq_error += sq_error; | 5698 cpi->total_sq_error += sq_error; |
| 5698 cpi->total += frame_psnr; | 5699 cpi->total += frame_psnr; |
| 5699 #if CONFIG_POSTPROC | 5700 #if CONFIG_POSTPROC |
| 5700 { | 5701 { |
| 5701 YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer; | 5702 YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer; |
| 5702 double sq_error2; | 5703 double sq_error2; |
| 5703 double frame_psnr2, frame_ssim2 = 0; | 5704 double frame_psnr2, frame_ssim2 = 0; |
| 5704 double weight = 0; | 5705 double weight = 0; |
| 5705 | 5706 |
| 5706 vp8_deblock(cm, cm->frame_to_show, &cm->post_proc_buffer, cm
->filter_level * 10 / 6, 1, 0); | 5707 vp8_deblock(cm, cm->frame_to_show, &cm->post_proc_buffer, cm
->filter_level * 10 / 6, 1, 0); |
| 5707 vp8_clear_system_state(); | 5708 vp8_clear_system_state(); |
| 5708 | 5709 |
| 5709 ye = calc_plane_error(orig->y_buffer, orig->y_stride, | 5710 ye = calc_plane_error(orig->y_buffer, orig->y_stride, |
| 5710 pp->y_buffer, pp->y_stride, orig->y_width, orig->y_height)
; | 5711 pp->y_buffer, pp->y_stride, y_width, y_height); |
| 5711 | 5712 |
| 5712 ue = calc_plane_error(orig->u_buffer, orig->uv_stride, | 5713 ue = calc_plane_error(orig->u_buffer, orig->uv_stride, |
| 5713 pp->u_buffer, pp->uv_stride, orig->uv_width, orig->uv_heig
ht); | 5714 pp->u_buffer, pp->uv_stride, uv_width, uv_height); |
| 5714 | 5715 |
| 5715 ve = calc_plane_error(orig->v_buffer, orig->uv_stride, | 5716 ve = calc_plane_error(orig->v_buffer, orig->uv_stride, |
| 5716 pp->v_buffer, pp->uv_stride, orig->uv_width, orig->uv_heig
ht); | 5717 pp->v_buffer, pp->uv_stride, uv_width, uv_height); |
| 5717 | 5718 |
| 5718 sq_error2 = (double)(ye + ue + ve); | 5719 sq_error2 = (double)(ye + ue + ve); |
| 5719 | 5720 |
| 5720 frame_psnr2 = vpx_sse_to_psnr(t_samples, 255.0, sq_error2); | 5721 frame_psnr2 = vpx_sse_to_psnr(t_samples, 255.0, sq_error2); |
| 5721 | 5722 |
| 5722 cpi->totalp_y += vpx_sse_to_psnr(y_samples, | 5723 cpi->totalp_y += vpx_sse_to_psnr(y_samples, |
| 5723 255.0, (double)ye); | 5724 255.0, (double)ye); |
| 5724 cpi->totalp_u += vpx_sse_to_psnr(uv_samples, | 5725 cpi->totalp_u += vpx_sse_to_psnr(uv_samples, |
| 5725 255.0, (double)ue); | 5726 255.0, (double)ue); |
| 5726 cpi->totalp_v += vpx_sse_to_psnr(uv_samples, | 5727 cpi->totalp_v += vpx_sse_to_psnr(uv_samples, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5988 } | 5989 } |
| 5989 | 5990 |
| 5990 return Total; | 5991 return Total; |
| 5991 } | 5992 } |
| 5992 | 5993 |
| 5993 | 5994 |
| 5994 int vp8_get_quantizer(VP8_COMP *cpi) | 5995 int vp8_get_quantizer(VP8_COMP *cpi) |
| 5995 { | 5996 { |
| 5996 return cpi->common.base_qindex; | 5997 return cpi->common.base_qindex; |
| 5997 } | 5998 } |
| OLD | NEW |