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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ct_16x16p[1][0] = tx_count_16x16p[TX_8X8]; | 296 ct_16x16p[1][0] = tx_count_16x16p[TX_8X8]; |
297 ct_16x16p[1][1] = tx_count_16x16p[TX_16X16]; | 297 ct_16x16p[1][1] = tx_count_16x16p[TX_16X16]; |
298 } | 298 } |
299 | 299 |
300 void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p, | 300 void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p, |
301 unsigned int (*ct_8x8p)[2]) { | 301 unsigned int (*ct_8x8p)[2]) { |
302 ct_8x8p[0][0] = tx_count_8x8p[TX_4X4]; | 302 ct_8x8p[0][0] = tx_count_8x8p[TX_4X4]; |
303 ct_8x8p[0][1] = tx_count_8x8p[TX_8X8]; | 303 ct_8x8p[0][1] = tx_count_8x8p[TX_8X8]; |
304 } | 304 } |
305 | 305 |
306 static const vp9_prob default_mbskip_probs[MBSKIP_CONTEXTS] = { | 306 static const vp9_prob default_skip_probs[SKIP_CONTEXTS] = { |
307 192, 128, 64 | 307 192, 128, 64 |
308 }; | 308 }; |
309 | 309 |
310 static const vp9_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] | 310 static const vp9_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] |
311 [SWITCHABLE_FILTERS - 1] = { | 311 [SWITCHABLE_FILTERS - 1] = { |
312 { 235, 162, }, | 312 { 235, 162, }, |
313 { 36, 255, }, | 313 { 36, 255, }, |
314 { 34, 3, }, | 314 { 34, 3, }, |
315 { 149, 144, }, | 315 { 149, 144, }, |
316 }; | 316 }; |
317 | 317 |
318 void vp9_init_mbmode_probs(VP9_COMMON *cm) { | 318 void vp9_init_mbmode_probs(VP9_COMMON *cm) { |
319 vp9_copy(cm->fc.uv_mode_prob, default_if_uv_probs); | 319 vp9_copy(cm->fc.uv_mode_prob, default_if_uv_probs); |
320 vp9_copy(cm->fc.y_mode_prob, default_if_y_probs); | 320 vp9_copy(cm->fc.y_mode_prob, default_if_y_probs); |
321 vp9_copy(cm->fc.switchable_interp_prob, default_switchable_interp_prob); | 321 vp9_copy(cm->fc.switchable_interp_prob, default_switchable_interp_prob); |
322 vp9_copy(cm->fc.partition_prob, default_partition_probs); | 322 vp9_copy(cm->fc.partition_prob, default_partition_probs); |
323 vp9_copy(cm->fc.intra_inter_prob, default_intra_inter_p); | 323 vp9_copy(cm->fc.intra_inter_prob, default_intra_inter_p); |
324 vp9_copy(cm->fc.comp_inter_prob, default_comp_inter_p); | 324 vp9_copy(cm->fc.comp_inter_prob, default_comp_inter_p); |
325 vp9_copy(cm->fc.comp_ref_prob, default_comp_ref_p); | 325 vp9_copy(cm->fc.comp_ref_prob, default_comp_ref_p); |
326 vp9_copy(cm->fc.single_ref_prob, default_single_ref_p); | 326 vp9_copy(cm->fc.single_ref_prob, default_single_ref_p); |
327 cm->fc.tx_probs = default_tx_probs; | 327 cm->fc.tx_probs = default_tx_probs; |
328 vp9_copy(cm->fc.mbskip_probs, default_mbskip_probs); | 328 vp9_copy(cm->fc.skip_probs, default_skip_probs); |
329 vp9_copy(cm->fc.inter_mode_probs, default_inter_mode_probs); | 329 vp9_copy(cm->fc.inter_mode_probs, default_inter_mode_probs); |
330 } | 330 } |
331 | 331 |
332 const vp9_tree_index vp9_switchable_interp_tree | 332 const vp9_tree_index vp9_switchable_interp_tree |
333 [TREE_SIZE(SWITCHABLE_FILTERS)] = { | 333 [TREE_SIZE(SWITCHABLE_FILTERS)] = { |
334 -EIGHTTAP, 2, | 334 -EIGHTTAP, 2, |
335 -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP | 335 -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP |
336 }; | 336 }; |
337 | 337 |
338 #define COUNT_SAT 20 | 338 #define COUNT_SAT 20 |
339 #define MAX_UPDATE_FACTOR 128 | 339 #define MAX_UPDATE_FACTOR 128 |
340 | 340 |
341 static int adapt_prob(vp9_prob pre_prob, const unsigned int ct[2]) { | 341 static int adapt_prob(vp9_prob pre_prob, const unsigned int ct[2]) { |
342 return merge_probs(pre_prob, ct, COUNT_SAT, MAX_UPDATE_FACTOR); | 342 return merge_probs(pre_prob, ct, COUNT_SAT, MAX_UPDATE_FACTOR); |
343 } | 343 } |
344 | 344 |
345 static void adapt_probs(const vp9_tree_index *tree, | 345 static void adapt_probs(const vp9_tree_index *tree, |
346 const vp9_prob *pre_probs, const unsigned int *counts, | 346 const vp9_prob *pre_probs, const unsigned int *counts, |
347 vp9_prob *probs) { | 347 vp9_prob *probs) { |
348 tree_merge_probs(tree, pre_probs, counts, COUNT_SAT, MAX_UPDATE_FACTOR, | 348 vp9_tree_merge_probs(tree, pre_probs, counts, COUNT_SAT, MAX_UPDATE_FACTOR, |
349 probs); | 349 probs); |
350 } | 350 } |
351 | 351 |
352 void vp9_adapt_mode_probs(VP9_COMMON *cm) { | 352 void vp9_adapt_mode_probs(VP9_COMMON *cm) { |
353 int i, j; | 353 int i, j; |
354 FRAME_CONTEXT *fc = &cm->fc; | 354 FRAME_CONTEXT *fc = &cm->fc; |
355 const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; | 355 const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; |
356 const FRAME_COUNTS *counts = &cm->counts; | 356 const FRAME_COUNTS *counts = &cm->counts; |
357 | 357 |
358 for (i = 0; i < INTRA_INTER_CONTEXTS; i++) | 358 for (i = 0; i < INTRA_INTER_CONTEXTS; i++) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 fc->tx_probs.p16x16[i][j] = adapt_prob(pre_fc->tx_probs.p16x16[i][j], | 408 fc->tx_probs.p16x16[i][j] = adapt_prob(pre_fc->tx_probs.p16x16[i][j], |
409 branch_ct_16x16p[j]); | 409 branch_ct_16x16p[j]); |
410 | 410 |
411 tx_counts_to_branch_counts_32x32(counts->tx.p32x32[i], branch_ct_32x32p); | 411 tx_counts_to_branch_counts_32x32(counts->tx.p32x32[i], branch_ct_32x32p); |
412 for (j = 0; j < TX_SIZES - 1; ++j) | 412 for (j = 0; j < TX_SIZES - 1; ++j) |
413 fc->tx_probs.p32x32[i][j] = adapt_prob(pre_fc->tx_probs.p32x32[i][j], | 413 fc->tx_probs.p32x32[i][j] = adapt_prob(pre_fc->tx_probs.p32x32[i][j], |
414 branch_ct_32x32p[j]); | 414 branch_ct_32x32p[j]); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 for (i = 0; i < MBSKIP_CONTEXTS; ++i) | 418 for (i = 0; i < SKIP_CONTEXTS; ++i) |
419 fc->mbskip_probs[i] = adapt_prob(pre_fc->mbskip_probs[i], | 419 fc->skip_probs[i] = adapt_prob(pre_fc->skip_probs[i], counts->skip[i]); |
420 counts->mbskip[i]); | |
421 } | 420 } |
422 | 421 |
423 static void set_default_lf_deltas(struct loopfilter *lf) { | 422 static void set_default_lf_deltas(struct loopfilter *lf) { |
424 lf->mode_ref_delta_enabled = 1; | 423 lf->mode_ref_delta_enabled = 1; |
425 lf->mode_ref_delta_update = 1; | 424 lf->mode_ref_delta_update = 1; |
426 | 425 |
427 lf->ref_deltas[INTRA_FRAME] = 1; | 426 lf->ref_deltas[INTRA_FRAME] = 1; |
428 lf->ref_deltas[LAST_FRAME] = 0; | 427 lf->ref_deltas[LAST_FRAME] = 0; |
429 lf->ref_deltas[GOLDEN_FRAME] = -1; | 428 lf->ref_deltas[GOLDEN_FRAME] = -1; |
430 lf->ref_deltas[ALTREF_FRAME] = -1; | 429 lf->ref_deltas[ALTREF_FRAME] = -1; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 467 |
469 vpx_memset(cm->prev_mip, 0, | 468 vpx_memset(cm->prev_mip, 0, |
470 cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO)); | 469 cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO)); |
471 vpx_memset(cm->mip, 0, | 470 vpx_memset(cm->mip, 0, |
472 cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO)); | 471 cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO)); |
473 | 472 |
474 vp9_zero(cm->ref_frame_sign_bias); | 473 vp9_zero(cm->ref_frame_sign_bias); |
475 | 474 |
476 cm->frame_context_idx = 0; | 475 cm->frame_context_idx = 0; |
477 } | 476 } |
OLD | NEW |