| 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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 intra_cost = bitcost(av_intra); | 933 intra_cost = bitcost(av_intra); |
| 934 | 934 |
| 935 /* Estimate of extra bits per mv overhead for mbs | 935 /* Estimate of extra bits per mv overhead for mbs |
| 936 * << 9 is the normalization to the (bits * 512) used in vp8_bits_per_mb | 936 * << 9 is the normalization to the (bits * 512) used in vp8_bits_per_mb |
| 937 */ | 937 */ |
| 938 mv_cost = ((int)(fpstats->new_mv_count / fpstats->count) * 8) << 9; | 938 mv_cost = ((int)(fpstats->new_mv_count / fpstats->count) * 8) << 9; |
| 939 | 939 |
| 940 /* Crude estimate of overhead cost from modes | 940 /* Crude estimate of overhead cost from modes |
| 941 * << 9 is the normalization to (bits * 512) used in vp8_bits_per_mb | 941 * << 9 is the normalization to (bits * 512) used in vp8_bits_per_mb |
| 942 */ | 942 */ |
| 943 mode_cost =((((av_pct_inter - av_pct_motion) * zz_cost) + | 943 mode_cost = (int64_t)((((av_pct_inter - av_pct_motion) * zz_cost) + |
| 944 (av_pct_motion * motion_cost) + | 944 (av_pct_motion * motion_cost) + |
| 945 (av_intra * intra_cost)) * cpi->common.MBs) * 512; | 945 (av_intra * intra_cost)) * cpi->common.MBs) * 512; |
| 946 | 946 |
| 947 return mv_cost + mode_cost; | 947 return mv_cost + mode_cost; |
| 948 } | 948 } |
| 949 | 949 |
| 950 static double calc_correction_factor( double err_per_mb, | 950 static double calc_correction_factor( double err_per_mb, |
| 951 double err_devisor, | 951 double err_devisor, |
| 952 double pt_low, | 952 double pt_low, |
| 953 double pt_high, | 953 double pt_high, |
| 954 int Q ) | 954 int Q ) |
| 955 { | 955 { |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 int boost = cpi->gfu_boost; | 2303 int boost = cpi->gfu_boost; |
| 2304 #endif | 2304 #endif |
| 2305 if ( boost >= 150 ) | 2305 if ( boost >= 150 ) |
| 2306 { | 2306 { |
| 2307 int pct_extra; | 2307 int pct_extra; |
| 2308 | 2308 |
| 2309 pct_extra = (boost - 100) / 50; | 2309 pct_extra = (boost - 100) / 50; |
| 2310 pct_extra = (pct_extra > 20) ? 20 : pct_extra; | 2310 pct_extra = (pct_extra > 20) ? 20 : pct_extra; |
| 2311 | 2311 |
| 2312 cpi->twopass.alt_extra_bits = | 2312 cpi->twopass.alt_extra_bits = |
| 2313 (cpi->twopass.gf_group_bits * pct_extra) / 100; | 2313 (int)(cpi->twopass.gf_group_bits * pct_extra) / 100; |
| 2314 cpi->twopass.gf_group_bits -= cpi->twopass.alt_extra_bits; | 2314 cpi->twopass.gf_group_bits -= cpi->twopass.alt_extra_bits; |
| 2315 cpi->twopass.alt_extra_bits /= | 2315 cpi->twopass.alt_extra_bits /= |
| 2316 ((cpi->baseline_gf_interval-1)>>1); | 2316 ((cpi->baseline_gf_interval-1)>>1); |
| 2317 } | 2317 } |
| 2318 else | 2318 else |
| 2319 cpi->twopass.alt_extra_bits = 0; | 2319 cpi->twopass.alt_extra_bits = 0; |
| 2320 } | 2320 } |
| 2321 else | 2321 else |
| 2322 cpi->twopass.alt_extra_bits = 0; | 2322 cpi->twopass.alt_extra_bits = 0; |
| 2323 } | 2323 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 * at the top end. | 2379 * at the top end. |
| 2380 */ | 2380 */ |
| 2381 if (target_frame_size < 0) | 2381 if (target_frame_size < 0) |
| 2382 target_frame_size = 0; | 2382 target_frame_size = 0; |
| 2383 else | 2383 else |
| 2384 { | 2384 { |
| 2385 if (target_frame_size > max_bits) | 2385 if (target_frame_size > max_bits) |
| 2386 target_frame_size = max_bits; | 2386 target_frame_size = max_bits; |
| 2387 | 2387 |
| 2388 if (target_frame_size > cpi->twopass.gf_group_bits) | 2388 if (target_frame_size > cpi->twopass.gf_group_bits) |
| 2389 target_frame_size = cpi->twopass.gf_group_bits; | 2389 target_frame_size = (int)cpi->twopass.gf_group_bits; |
| 2390 } | 2390 } |
| 2391 | 2391 |
| 2392 /* Adjust error and bits remaining */ | 2392 /* Adjust error and bits remaining */ |
| 2393 cpi->twopass.gf_group_error_left -= (int)modified_err; | 2393 cpi->twopass.gf_group_error_left -= (int)modified_err; |
| 2394 cpi->twopass.gf_group_bits -= target_frame_size; | 2394 cpi->twopass.gf_group_bits -= target_frame_size; |
| 2395 | 2395 |
| 2396 if (cpi->twopass.gf_group_bits < 0) | 2396 if (cpi->twopass.gf_group_bits < 0) |
| 2397 cpi->twopass.gf_group_bits = 0; | 2397 cpi->twopass.gf_group_bits = 0; |
| 2398 | 2398 |
| 2399 /* Add in the minimum number of bits that is set aside for every frame. */ | 2399 /* Add in the minimum number of bits that is set aside for every frame. */ |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 } | 3358 } |
| 3359 | 3359 |
| 3360 if ((cpi->common.Width != new_width) || (cpi->common.Height != new_heigh
t)) | 3360 if ((cpi->common.Width != new_width) || (cpi->common.Height != new_heigh
t)) |
| 3361 { | 3361 { |
| 3362 cpi->common.Width = new_width; | 3362 cpi->common.Width = new_width; |
| 3363 cpi->common.Height = new_height; | 3363 cpi->common.Height = new_height; |
| 3364 vp8_alloc_compressor_data(cpi); | 3364 vp8_alloc_compressor_data(cpi); |
| 3365 } | 3365 } |
| 3366 } | 3366 } |
| 3367 } | 3367 } |
| OLD | NEW |