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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 static void adapt_probs(const vp9_tree_index *tree, | 344 static void adapt_probs(const vp9_tree_index *tree, |
345 const vp9_prob *pre_probs, const unsigned int *counts, | 345 const vp9_prob *pre_probs, const unsigned int *counts, |
346 vp9_prob *probs) { | 346 vp9_prob *probs) { |
347 vp9_tree_merge_probs(tree, pre_probs, counts, COUNT_SAT, MAX_UPDATE_FACTOR, | 347 vp9_tree_merge_probs(tree, pre_probs, counts, COUNT_SAT, MAX_UPDATE_FACTOR, |
348 probs); | 348 probs); |
349 } | 349 } |
350 | 350 |
351 void vp9_adapt_mode_probs(VP9_COMMON *cm) { | 351 void vp9_adapt_mode_probs(VP9_COMMON *cm) { |
352 int i, j; | 352 int i, j; |
353 FRAME_CONTEXT *fc = &cm->fc; | 353 FRAME_CONTEXT *fc = cm->fc; |
354 const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; | 354 const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; |
355 const FRAME_COUNTS *counts = &cm->counts; | 355 const FRAME_COUNTS *counts = &cm->counts; |
356 | 356 |
357 for (i = 0; i < INTRA_INTER_CONTEXTS; i++) | 357 for (i = 0; i < INTRA_INTER_CONTEXTS; i++) |
358 fc->intra_inter_prob[i] = adapt_prob(pre_fc->intra_inter_prob[i], | 358 fc->intra_inter_prob[i] = adapt_prob(pre_fc->intra_inter_prob[i], |
359 counts->intra_inter[i]); | 359 counts->intra_inter[i]); |
360 for (i = 0; i < COMP_INTER_CONTEXTS; i++) | 360 for (i = 0; i < COMP_INTER_CONTEXTS; i++) |
361 fc->comp_inter_prob[i] = adapt_prob(pre_fc->comp_inter_prob[i], | 361 fc->comp_inter_prob[i] = adapt_prob(pre_fc->comp_inter_prob[i], |
362 counts->comp_inter[i]); | 362 counts->comp_inter[i]); |
363 for (i = 0; i < REF_CONTEXTS; i++) | 363 for (i = 0; i < REF_CONTEXTS; i++) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 // Reset the mode ref deltas for loop filter | 445 // Reset the mode ref deltas for loop filter |
446 vp9_zero(lf->last_ref_deltas); | 446 vp9_zero(lf->last_ref_deltas); |
447 vp9_zero(lf->last_mode_deltas); | 447 vp9_zero(lf->last_mode_deltas); |
448 set_default_lf_deltas(lf); | 448 set_default_lf_deltas(lf); |
449 | 449 |
450 // To force update of the sharpness | 450 // To force update of the sharpness |
451 lf->last_sharpness_level = -1; | 451 lf->last_sharpness_level = -1; |
452 | 452 |
453 vp9_default_coef_probs(cm); | 453 vp9_default_coef_probs(cm); |
454 vp9_init_mode_probs(&cm->fc); | 454 vp9_init_mode_probs(cm->fc); |
455 vp9_init_mv_probs(cm); | 455 vp9_init_mv_probs(cm); |
456 | 456 |
457 if (cm->frame_type == KEY_FRAME || | 457 if (cm->frame_type == KEY_FRAME || |
458 cm->error_resilient_mode || cm->reset_frame_context == 3) { | 458 cm->error_resilient_mode || cm->reset_frame_context == 3) { |
459 // Reset all frame contexts. | 459 // Reset all frame contexts. |
460 for (i = 0; i < FRAME_CONTEXTS; ++i) | 460 for (i = 0; i < FRAME_CONTEXTS; ++i) |
461 cm->frame_contexts[i] = cm->fc; | 461 cm->frame_contexts[i] = *cm->fc; |
462 } else if (cm->reset_frame_context == 2) { | 462 } else if (cm->reset_frame_context == 2) { |
463 // Reset only the frame context specified in the frame header. | 463 // Reset only the frame context specified in the frame header. |
464 cm->frame_contexts[cm->frame_context_idx] = cm->fc; | 464 cm->frame_contexts[cm->frame_context_idx] = *cm->fc; |
465 } | 465 } |
466 | 466 |
467 if (frame_is_intra_only(cm)) | 467 // prev_mip will only be allocated in encoder. |
| 468 if (frame_is_intra_only(cm) && cm->prev_mip) |
468 vpx_memset(cm->prev_mip, 0, cm->mi_stride * (cm->mi_rows + 1) * | 469 vpx_memset(cm->prev_mip, 0, cm->mi_stride * (cm->mi_rows + 1) * |
469 sizeof(*cm->prev_mip)); | 470 sizeof(*cm->prev_mip)); |
470 | 471 |
471 vpx_memset(cm->mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip)); | 472 vpx_memset(cm->mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip)); |
472 | 473 |
473 vp9_zero(cm->ref_frame_sign_bias); | 474 vp9_zero(cm->ref_frame_sign_bias); |
474 | 475 |
475 cm->frame_context_idx = 0; | 476 cm->frame_context_idx = 0; |
476 } | 477 } |
OLD | NEW |