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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 double *ssim_v | 91 double *ssim_v |
92 ); | 92 ); |
93 | 93 |
94 | 94 |
95 #endif | 95 #endif |
96 | 96 |
97 | 97 |
98 #ifdef OUTPUT_YUV_SRC | 98 #ifdef OUTPUT_YUV_SRC |
99 FILE *yuv_file; | 99 FILE *yuv_file; |
100 #endif | 100 #endif |
| 101 #ifdef OUTPUT_YUV_DENOISED |
| 102 FILE *yuv_denoised_file; |
| 103 #endif |
101 | 104 |
102 #if 0 | 105 #if 0 |
103 FILE *framepsnr; | 106 FILE *framepsnr; |
104 FILE *kf_list; | 107 FILE *kf_list; |
105 FILE *keyfile; | 108 FILE *keyfile; |
106 #endif | 109 #endif |
107 | 110 |
108 #if 0 | 111 #if 0 |
109 extern int skip_true_count; | 112 extern int skip_true_count; |
110 extern int skip_false_count; | 113 extern int skip_false_count; |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 cpi->alt_ref_source = NULL; | 1744 cpi->alt_ref_source = NULL; |
1742 cpi->is_src_frame_alt_ref = 0; | 1745 cpi->is_src_frame_alt_ref = 0; |
1743 | 1746 |
1744 #if CONFIG_TEMPORAL_DENOISING | 1747 #if CONFIG_TEMPORAL_DENOISING |
1745 if (cpi->oxcf.noise_sensitivity) | 1748 if (cpi->oxcf.noise_sensitivity) |
1746 { | 1749 { |
1747 if (!cpi->denoiser.yv12_mc_running_avg.buffer_alloc) | 1750 if (!cpi->denoiser.yv12_mc_running_avg.buffer_alloc) |
1748 { | 1751 { |
1749 int width = (cpi->oxcf.Width + 15) & ~15; | 1752 int width = (cpi->oxcf.Width + 15) & ~15; |
1750 int height = (cpi->oxcf.Height + 15) & ~15; | 1753 int height = (cpi->oxcf.Height + 15) & ~15; |
1751 vp8_denoiser_allocate(&cpi->denoiser, width, height); | 1754 vp8_denoiser_allocate(&cpi->denoiser, width, height, |
| 1755 cpi->common.mb_rows, cpi->common.mb_cols); |
1752 } | 1756 } |
1753 } | 1757 } |
1754 #endif | 1758 #endif |
1755 | 1759 |
1756 #if 0 | 1760 #if 0 |
1757 /* Experimental RD Code */ | 1761 /* Experimental RD Code */ |
1758 cpi->frame_distortion = 0; | 1762 cpi->frame_distortion = 0; |
1759 cpi->last_frame_distortion = 0; | 1763 cpi->last_frame_distortion = 0; |
1760 #endif | 1764 #endif |
1761 | 1765 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 cpi->twopass.est_max_qcorrection_factor = 1.0; | 1958 cpi->twopass.est_max_qcorrection_factor = 1.0; |
1955 | 1959 |
1956 for (i = 0; i < KEY_FRAME_CONTEXT; i++) | 1960 for (i = 0; i < KEY_FRAME_CONTEXT; i++) |
1957 { | 1961 { |
1958 cpi->prior_key_frame_distance[i] = (int)cpi->output_framerate; | 1962 cpi->prior_key_frame_distance[i] = (int)cpi->output_framerate; |
1959 } | 1963 } |
1960 | 1964 |
1961 #ifdef OUTPUT_YUV_SRC | 1965 #ifdef OUTPUT_YUV_SRC |
1962 yuv_file = fopen("bd.yuv", "ab"); | 1966 yuv_file = fopen("bd.yuv", "ab"); |
1963 #endif | 1967 #endif |
| 1968 #ifdef OUTPUT_YUV_DENOISED |
| 1969 yuv_denoised_file = fopen("denoised.yuv", "ab"); |
| 1970 #endif |
1964 | 1971 |
1965 #if 0 | 1972 #if 0 |
1966 framepsnr = fopen("framepsnr.stt", "a"); | 1973 framepsnr = fopen("framepsnr.stt", "a"); |
1967 kf_list = fopen("kf_list.stt", "w"); | 1974 kf_list = fopen("kf_list.stt", "w"); |
1968 #endif | 1975 #endif |
1969 | 1976 |
1970 cpi->output_pkt_list = oxcf->output_pkt_list; | 1977 cpi->output_pkt_list = oxcf->output_pkt_list; |
1971 | 1978 |
1972 #if !(CONFIG_REALTIME_ONLY) | 1979 #if !(CONFIG_REALTIME_ONLY) |
1973 | 1980 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 vpx_free(cpi->tok); | 2410 vpx_free(cpi->tok); |
2404 vpx_free(cpi->cyclic_refresh_map); | 2411 vpx_free(cpi->cyclic_refresh_map); |
2405 | 2412 |
2406 vp8_remove_common(&cpi->common); | 2413 vp8_remove_common(&cpi->common); |
2407 vpx_free(cpi); | 2414 vpx_free(cpi); |
2408 *ptr = 0; | 2415 *ptr = 0; |
2409 | 2416 |
2410 #ifdef OUTPUT_YUV_SRC | 2417 #ifdef OUTPUT_YUV_SRC |
2411 fclose(yuv_file); | 2418 fclose(yuv_file); |
2412 #endif | 2419 #endif |
| 2420 #ifdef OUTPUT_YUV_DENOISED |
| 2421 fclose(yuv_denoised_file); |
| 2422 #endif |
2413 | 2423 |
2414 #if 0 | 2424 #if 0 |
2415 | 2425 |
2416 if (keyfile) | 2426 if (keyfile) |
2417 fclose(keyfile); | 2427 fclose(keyfile); |
2418 | 2428 |
2419 if (framepsnr) | 2429 if (framepsnr) |
2420 fclose(framepsnr); | 2430 fclose(framepsnr); |
2421 | 2431 |
2422 if (kf_list) | 2432 if (kf_list) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 } | 2613 } |
2604 int vp8_update_entropy(VP8_COMP *cpi, int update) | 2614 int vp8_update_entropy(VP8_COMP *cpi, int update) |
2605 { | 2615 { |
2606 VP8_COMMON *cm = &cpi->common; | 2616 VP8_COMMON *cm = &cpi->common; |
2607 cm->refresh_entropy_probs = update; | 2617 cm->refresh_entropy_probs = update; |
2608 | 2618 |
2609 return 0; | 2619 return 0; |
2610 } | 2620 } |
2611 | 2621 |
2612 | 2622 |
2613 #if OUTPUT_YUV_SRC | 2623 #if defined(OUTPUT_YUV_SRC) || defined(OUTPUT_YUV_DENOISED) |
2614 void vp8_write_yuv_frame(const char *name, YV12_BUFFER_CONFIG *s) | 2624 void vp8_write_yuv_frame(FILE *yuv_file, YV12_BUFFER_CONFIG *s) |
2615 { | 2625 { |
2616 FILE *yuv_file = fopen(name, "ab"); | |
2617 unsigned char *src = s->y_buffer; | 2626 unsigned char *src = s->y_buffer; |
2618 int h = s->y_height; | 2627 int h = s->y_height; |
2619 | 2628 |
2620 do | 2629 do |
2621 { | 2630 { |
2622 fwrite(src, s->y_width, 1, yuv_file); | 2631 fwrite(src, s->y_width, 1, yuv_file); |
2623 src += s->y_stride; | 2632 src += s->y_stride; |
2624 } | 2633 } |
2625 while (--h); | 2634 while (--h); |
2626 | 2635 |
2627 src = s->u_buffer; | 2636 src = s->u_buffer; |
2628 h = s->uv_height; | 2637 h = s->uv_height; |
2629 | 2638 |
2630 do | 2639 do |
2631 { | 2640 { |
2632 fwrite(src, s->uv_width, 1, yuv_file); | 2641 fwrite(src, s->uv_width, 1, yuv_file); |
2633 src += s->uv_stride; | 2642 src += s->uv_stride; |
2634 } | 2643 } |
2635 while (--h); | 2644 while (--h); |
2636 | 2645 |
2637 src = s->v_buffer; | 2646 src = s->v_buffer; |
2638 h = s->uv_height; | 2647 h = s->uv_height; |
2639 | 2648 |
2640 do | 2649 do |
2641 { | 2650 { |
2642 fwrite(src, s->uv_width, 1, yuv_file); | 2651 fwrite(src, s->uv_width, 1, yuv_file); |
2643 src += s->uv_stride; | 2652 src += s->uv_stride; |
2644 } | 2653 } |
2645 while (--h); | 2654 while (--h); |
2646 | |
2647 fclose(yuv_file); | |
2648 } | 2655 } |
2649 #endif | 2656 #endif |
2650 | 2657 |
2651 | |
2652 static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) | 2658 static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) |
2653 { | 2659 { |
2654 VP8_COMMON *cm = &cpi->common; | 2660 VP8_COMMON *cm = &cpi->common; |
2655 | 2661 |
2656 /* are we resizing the image */ | 2662 /* are we resizing the image */ |
2657 if (cm->horiz_scale != 0 || cm->vert_scale != 0) | 2663 if (cm->horiz_scale != 0 || cm->vert_scale != 0) |
2658 { | 2664 { |
2659 #if CONFIG_SPATIAL_RESAMPLING | 2665 #if CONFIG_SPATIAL_RESAMPLING |
2660 int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs); | 2666 int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs); |
2661 int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs); | 2667 int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs); |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3888 if (cpi->Source->y_stride < 0) | 3894 if (cpi->Source->y_stride < 0) |
3889 { | 3895 { |
3890 src += cpi->Source->y_stride * (cpi->Source->y_height - 1); | 3896 src += cpi->Source->y_stride * (cpi->Source->y_height - 1); |
3891 } | 3897 } |
3892 } | 3898 } |
3893 } | 3899 } |
3894 | 3900 |
3895 #endif | 3901 #endif |
3896 | 3902 |
3897 #ifdef OUTPUT_YUV_SRC | 3903 #ifdef OUTPUT_YUV_SRC |
3898 vp8_write_yuv_frame(cpi->Source); | 3904 vp8_write_yuv_frame(yuv_file, cpi->Source); |
3899 #endif | 3905 #endif |
3900 | 3906 |
3901 do | 3907 do |
3902 { | 3908 { |
3903 vp8_clear_system_state(); | 3909 vp8_clear_system_state(); |
3904 | 3910 |
3905 vp8_set_quantizer(cpi, Q); | 3911 vp8_set_quantizer(cpi, Q); |
3906 | 3912 |
3907 /* setup skip prob for costing in mode/mv decision */ | 3913 /* setup skip prob for costing in mode/mv decision */ |
3908 if (cpi->common.mb_no_coeff_skip) | 3914 if (cpi->common.mb_no_coeff_skip) |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4427 cpi->b_lpf_running = 1; | 4433 cpi->b_lpf_running = 1; |
4428 } | 4434 } |
4429 else | 4435 else |
4430 #endif | 4436 #endif |
4431 { | 4437 { |
4432 vp8_loopfilter_frame(cpi, cm); | 4438 vp8_loopfilter_frame(cpi, cm); |
4433 } | 4439 } |
4434 | 4440 |
4435 update_reference_frames(cpi); | 4441 update_reference_frames(cpi); |
4436 | 4442 |
| 4443 #ifdef OUTPUT_YUV_DENOISED |
| 4444 vp8_write_yuv_frame(yuv_denoised_file, |
| 4445 &cpi->denoiser.yv12_running_avg[INTRA_FRAME]); |
| 4446 #endif |
| 4447 |
4437 #if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING) | 4448 #if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING) |
4438 if (cpi->oxcf.error_resilient_mode) | 4449 if (cpi->oxcf.error_resilient_mode) |
4439 { | 4450 { |
4440 cm->refresh_entropy_probs = 0; | 4451 cm->refresh_entropy_probs = 0; |
4441 } | 4452 } |
4442 #endif | 4453 #endif |
4443 | 4454 |
4444 #if CONFIG_MULTITHREAD | 4455 #if CONFIG_MULTITHREAD |
4445 /* wait that filter_level is picked so that we can continue with stream pack
ing */ | 4456 /* wait that filter_level is picked so that we can continue with stream pack
ing */ |
4446 if (cpi->b_multi_threaded) | 4457 if (cpi->b_multi_threaded) |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5538 } | 5549 } |
5539 | 5550 |
5540 return Total; | 5551 return Total; |
5541 } | 5552 } |
5542 | 5553 |
5543 | 5554 |
5544 int vp8_get_quantizer(VP8_COMP *cpi) | 5555 int vp8_get_quantizer(VP8_COMP *cpi) |
5545 { | 5556 { |
5546 return cpi->common.base_qindex; | 5557 return cpi->common.base_qindex; |
5547 } | 5558 } |
OLD | NEW |