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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 VP9_NMV_UPDATE_PROB); | 534 VP9_NMV_UPDATE_PROB); |
535 } | 535 } |
536 } | 536 } |
537 } | 537 } |
538 | 538 |
539 void vp9_encode_mv(vp9_writer* w, const MV* mv, const MV* ref, | 539 void vp9_encode_mv(vp9_writer* w, const MV* mv, const MV* ref, |
540 const nmv_context* mvctx, int usehp) { | 540 const nmv_context* mvctx, int usehp) { |
541 const MV diff = {mv->row - ref->row, | 541 const MV diff = {mv->row - ref->row, |
542 mv->col - ref->col}; | 542 mv->col - ref->col}; |
543 const MV_JOINT_TYPE j = vp9_get_mv_joint(&diff); | 543 const MV_JOINT_TYPE j = vp9_get_mv_joint(&diff); |
544 usehp = usehp && vp9_use_nmv_hp(ref); | 544 usehp = usehp && vp9_use_mv_hp(ref); |
545 | 545 |
546 write_token(w, vp9_mv_joint_tree, mvctx->joints, &vp9_mv_joint_encodings[j]); | 546 write_token(w, vp9_mv_joint_tree, mvctx->joints, &vp9_mv_joint_encodings[j]); |
547 if (mv_joint_vertical(j)) | 547 if (mv_joint_vertical(j)) |
548 encode_mv_component(w, diff.row, &mvctx->comps[0], usehp); | 548 encode_mv_component(w, diff.row, &mvctx->comps[0], usehp); |
549 | 549 |
550 if (mv_joint_horizontal(j)) | 550 if (mv_joint_horizontal(j)) |
551 encode_mv_component(w, diff.col, &mvctx->comps[1], usehp); | 551 encode_mv_component(w, diff.col, &mvctx->comps[1], usehp); |
552 } | 552 } |
553 | 553 |
554 void vp9_build_nmv_cost_table(int *mvjoint, | 554 void vp9_build_nmv_cost_table(int *mvjoint, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 vp9_increment_nmv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount, | 601 vp9_increment_nmv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount, |
602 x->e_mbd.allow_high_precision_mv); | 602 x->e_mbd.allow_high_precision_mv); |
603 if (mbmi->ref_frame[1] > INTRA_FRAME) { | 603 if (mbmi->ref_frame[1] > INTRA_FRAME) { |
604 mv.row = (mbmi->mv[1].as_mv.row - second_best_ref_mv->as_mv.row); | 604 mv.row = (mbmi->mv[1].as_mv.row - second_best_ref_mv->as_mv.row); |
605 mv.col = (mbmi->mv[1].as_mv.col - second_best_ref_mv->as_mv.col); | 605 mv.col = (mbmi->mv[1].as_mv.col - second_best_ref_mv->as_mv.col); |
606 vp9_increment_nmv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount, | 606 vp9_increment_nmv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount, |
607 x->e_mbd.allow_high_precision_mv); | 607 x->e_mbd.allow_high_precision_mv); |
608 } | 608 } |
609 } | 609 } |
610 } | 610 } |
OLD | NEW |