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 |
11 | 11 |
12 #include "vpx_config.h" | 12 #include "vpx_config.h" |
| 13 #include "./vpx_scale_rtcd.h" |
13 #include "vp8/common/onyxc_int.h" | 14 #include "vp8/common/onyxc_int.h" |
14 #include "vp8/common/blockd.h" | 15 #include "vp8/common/blockd.h" |
15 #include "onyx_int.h" | 16 #include "onyx_int.h" |
16 #include "vp8/common/systemdependent.h" | 17 #include "vp8/common/systemdependent.h" |
17 #include "quantize.h" | 18 #include "quantize.h" |
18 #include "vp8/common/alloccommon.h" | 19 #include "vp8/common/alloccommon.h" |
19 #include "mcomp.h" | 20 #include "mcomp.h" |
20 #include "firstpass.h" | 21 #include "firstpass.h" |
21 #include "psnr.h" | 22 #include "psnr.h" |
22 #include "vpx_scale/vpxscale.h" | 23 #include "vpx_scale/vpxscale.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 vpx_free(cpi->tok); | 349 vpx_free(cpi->tok); |
349 cpi->tok = 0; | 350 cpi->tok = 0; |
350 | 351 |
351 /* Structure used to monitor GF usage */ | 352 /* Structure used to monitor GF usage */ |
352 vpx_free(cpi->gf_active_flags); | 353 vpx_free(cpi->gf_active_flags); |
353 cpi->gf_active_flags = 0; | 354 cpi->gf_active_flags = 0; |
354 | 355 |
355 /* Activity mask based per mb zbin adjustments */ | 356 /* Activity mask based per mb zbin adjustments */ |
356 vpx_free(cpi->mb_activity_map); | 357 vpx_free(cpi->mb_activity_map); |
357 cpi->mb_activity_map = 0; | 358 cpi->mb_activity_map = 0; |
| 359 vpx_free(cpi->mb_norm_activity_map); |
| 360 cpi->mb_norm_activity_map = 0; |
358 | 361 |
359 vpx_free(cpi->mb.pip); | 362 vpx_free(cpi->mb.pip); |
360 cpi->mb.pip = 0; | 363 cpi->mb.pip = 0; |
361 | 364 |
362 #if CONFIG_MULTITHREAD | 365 #if CONFIG_MULTITHREAD |
363 vpx_free(cpi->mt_current_mb_col); | 366 vpx_free(cpi->mt_current_mb_col); |
364 cpi->mt_current_mb_col = NULL; | 367 cpi->mt_current_mb_col = NULL; |
365 #endif | 368 #endif |
366 } | 369 } |
367 | 370 |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 CHECK_MEM_ERROR(cpi->gf_active_flags, | 1091 CHECK_MEM_ERROR(cpi->gf_active_flags, |
1089 vpx_calloc(sizeof(*cpi->gf_active_flags), | 1092 vpx_calloc(sizeof(*cpi->gf_active_flags), |
1090 cm->mb_rows * cm->mb_cols)); | 1093 cm->mb_rows * cm->mb_cols)); |
1091 cpi->gf_active_count = cm->mb_rows * cm->mb_cols; | 1094 cpi->gf_active_count = cm->mb_rows * cm->mb_cols; |
1092 | 1095 |
1093 vpx_free(cpi->mb_activity_map); | 1096 vpx_free(cpi->mb_activity_map); |
1094 CHECK_MEM_ERROR(cpi->mb_activity_map, | 1097 CHECK_MEM_ERROR(cpi->mb_activity_map, |
1095 vpx_calloc(sizeof(*cpi->mb_activity_map), | 1098 vpx_calloc(sizeof(*cpi->mb_activity_map), |
1096 cm->mb_rows * cm->mb_cols)); | 1099 cm->mb_rows * cm->mb_cols)); |
1097 | 1100 |
| 1101 vpx_free(cpi->mb_norm_activity_map); |
| 1102 CHECK_MEM_ERROR(cpi->mb_norm_activity_map, |
| 1103 vpx_calloc(sizeof(*cpi->mb_norm_activity_map), |
| 1104 cm->mb_rows * cm->mb_cols)); |
| 1105 |
1098 /* allocate memory for storing last frame's MVs for MV prediction. */ | 1106 /* allocate memory for storing last frame's MVs for MV prediction. */ |
1099 vpx_free(cpi->lfmv); | 1107 vpx_free(cpi->lfmv); |
1100 CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2), | 1108 CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2), |
1101 sizeof(*cpi->lfmv))); | 1109 sizeof(*cpi->lfmv))); |
1102 vpx_free(cpi->lf_ref_frame_sign_bias); | 1110 vpx_free(cpi->lf_ref_frame_sign_bias); |
1103 CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias, | 1111 CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias, |
1104 vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2), | 1112 vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2), |
1105 sizeof(*cpi->lf_ref_frame_sign_bias))); | 1113 sizeof(*cpi->lf_ref_frame_sign_bias))); |
1106 vpx_free(cpi->lf_ref_frame); | 1114 vpx_free(cpi->lf_ref_frame); |
1107 CHECK_MEM_ERROR(cpi->lf_ref_frame, | 1115 CHECK_MEM_ERROR(cpi->lf_ref_frame, |
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2850 cpi->kf_boost = 0; | 2858 cpi->kf_boost = 0; |
2851 | 2859 |
2852 if (cpi->Speed > 11) | 2860 if (cpi->Speed > 11) |
2853 return 0; | 2861 return 0; |
2854 | 2862 |
2855 /* Clear down mmx registers */ | 2863 /* Clear down mmx registers */ |
2856 vp8_clear_system_state(); | 2864 vp8_clear_system_state(); |
2857 | 2865 |
2858 if ((cpi->compressor_speed == 2) && (cpi->Speed >= 5) && (cpi->sf.RD == 0)) | 2866 if ((cpi->compressor_speed == 2) && (cpi->Speed >= 5) && (cpi->sf.RD == 0)) |
2859 { | 2867 { |
2860 double change = 1.0 * abs((int)(cpi->mb.intra_error - | 2868 double change = 1.0 * abs((int)(cpi->intra_error - cpi->last_intra_error
)) / (1 + cpi->last_intra_error); |
2861 cpi->last_intra_error)) / (1 + cpi->last_intra_error); | 2869 double change2 = 1.0 * abs((int)(cpi->prediction_error - cpi->last_predi
ction_error)) / (1 + cpi->last_prediction_error); |
2862 double change2 = 1.0 * abs((int)(cpi->mb.prediction_error - | |
2863 cpi->last_prediction_error)) / (1 + cpi->last_prediction_error); | |
2864 double minerror = cm->MBs * 256; | 2870 double minerror = cm->MBs * 256; |
2865 | 2871 |
2866 cpi->last_intra_error = cpi->mb.intra_error; | 2872 #if 0 |
2867 cpi->last_prediction_error = cpi->mb.prediction_error; | |
2868 | 2873 |
2869 if (10 * cpi->mb.intra_error / (1 + cpi->mb.prediction_error) < 15 | 2874 if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15 |
2870 && cpi->mb.prediction_error > minerror | 2875 && cpi->prediction_error > minerror |
| 2876 && (change > .25 || change2 > .25)) |
| 2877 { |
| 2878 FILE *f = fopen("intra_inter.stt", "a"); |
| 2879 |
| 2880 if (cpi->prediction_error <= 0) |
| 2881 cpi->prediction_error = 1; |
| 2882 |
| 2883 fprintf(f, "%d %d %d %d %14.4f\n", |
| 2884 cm->current_video_frame, |
| 2885 (int) cpi->prediction_error, |
| 2886 (int) cpi->intra_error, |
| 2887 (int)((10 * cpi->intra_error) / cpi->prediction_error), |
| 2888 change); |
| 2889 |
| 2890 fclose(f); |
| 2891 } |
| 2892 |
| 2893 #endif |
| 2894 |
| 2895 cpi->last_intra_error = cpi->intra_error; |
| 2896 cpi->last_prediction_error = cpi->prediction_error; |
| 2897 |
| 2898 if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15 |
| 2899 && cpi->prediction_error > minerror |
2871 && (change > .25 || change2 > .25)) | 2900 && (change > .25 || change2 > .25)) |
2872 { | 2901 { |
2873 /*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > c
pi->last_frame_percent_intra + 3*/ | 2902 /*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > c
pi->last_frame_percent_intra + 3*/ |
2874 return 1; | 2903 return 1; |
2875 } | 2904 } |
2876 | 2905 |
2877 return 0; | 2906 return 0; |
2878 | 2907 |
2879 } | 2908 } |
2880 | 2909 |
(...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5559 } | 5588 } |
5560 | 5589 |
5561 return Total; | 5590 return Total; |
5562 } | 5591 } |
5563 | 5592 |
5564 | 5593 |
5565 int vp8_get_quantizer(VP8_COMP *cpi) | 5594 int vp8_get_quantizer(VP8_COMP *cpi) |
5566 { | 5595 { |
5567 return cpi->common.base_qindex; | 5596 return cpi->common.base_qindex; |
5568 } | 5597 } |
OLD | NEW |