Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_pickmode.c

Issue 1217053002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_mcomp.c ('k') | source/libvpx/vp9/encoder/vp9_quantize.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 if (*skippable && *sse < INT64_MAX) { 651 if (*skippable && *sse < INT64_MAX) {
652 *rate = 0; 652 *rate = 0;
653 *dist = (*sse << 6) >> shift; 653 *dist = (*sse << 6) >> shift;
654 *sse = *dist; 654 *sse = *dist;
655 return; 655 return;
656 } 656 }
657 657
658 block = 0; 658 block = 0;
659 *rate = 0; 659 *rate = 0;
660 *dist = 0; 660 *dist = 0;
661 *sse = (*sse << 6) >> shift; 661 if (*sse < INT64_MAX)
662 *sse = (*sse << 6) >> shift;
662 for (r = 0; r < max_blocks_high; r += block_step) { 663 for (r = 0; r < max_blocks_high; r += block_step) {
663 for (c = 0; c < num_4x4_w; c += block_step) { 664 for (c = 0; c < num_4x4_w; c += block_step) {
664 if (c < max_blocks_wide) { 665 if (c < max_blocks_wide) {
665 tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); 666 tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
666 tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); 667 tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
667 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); 668 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
668 uint16_t *const eob = &p->eobs[block]; 669 uint16_t *const eob = &p->eobs[block];
669 670
670 if (*eob == 1) 671 if (*eob == 1)
671 *rate += (int)abs(qcoeff[0]); 672 *rate += (int)abs(qcoeff[0]);
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 1173
1173 if ((cpi->ref_frame_flags & flag_list[ref_frame]) && (yv12 != NULL)) { 1174 if ((cpi->ref_frame_flags & flag_list[ref_frame]) && (yv12 != NULL)) {
1174 int_mv *const candidates = mbmi->ref_mvs[ref_frame]; 1175 int_mv *const candidates = mbmi->ref_mvs[ref_frame];
1175 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf; 1176 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf;
1176 1177
1177 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, 1178 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col,
1178 sf, sf); 1179 sf, sf);
1179 1180
1180 if (cm->use_prev_frame_mvs) 1181 if (cm->use_prev_frame_mvs)
1181 vp9_find_mv_refs(cm, xd, tile_info, xd->mi[0], ref_frame, 1182 vp9_find_mv_refs(cm, xd, tile_info, xd->mi[0], ref_frame,
1182 candidates, mi_row, mi_col, NULL, NULL); 1183 candidates, mi_row, mi_col, NULL, NULL,
1184 xd->mi[0]->mbmi.mode_context);
1183 else 1185 else
1184 const_motion[ref_frame] = mv_refs_rt(cm, xd, tile_info, 1186 const_motion[ref_frame] = mv_refs_rt(cm, xd, tile_info,
1185 xd->mi[0], 1187 xd->mi[0],
1186 ref_frame, candidates, 1188 ref_frame, candidates,
1187 mi_row, mi_col); 1189 mi_row, mi_col);
1188 1190
1189 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, 1191 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates,
1190 &frame_mv[NEARESTMV][ref_frame], 1192 &frame_mv[NEARESTMV][ref_frame],
1191 &frame_mv[NEARMV][ref_frame]); 1193 &frame_mv[NEARMV][ref_frame]);
1192 1194
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 int_mv dummy_mv[2]; 1653 int_mv dummy_mv[2];
1652 x->pred_mv_sad[ref_frame] = INT_MAX; 1654 x->pred_mv_sad[ref_frame] = INT_MAX;
1653 1655
1654 if ((cpi->ref_frame_flags & flag_list[ref_frame]) && (yv12 != NULL)) { 1656 if ((cpi->ref_frame_flags & flag_list[ref_frame]) && (yv12 != NULL)) {
1655 int_mv *const candidates = mbmi->ref_mvs[ref_frame]; 1657 int_mv *const candidates = mbmi->ref_mvs[ref_frame];
1656 const struct scale_factors *const sf = 1658 const struct scale_factors *const sf =
1657 &cm->frame_refs[ref_frame - 1].sf; 1659 &cm->frame_refs[ref_frame - 1].sf;
1658 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, 1660 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col,
1659 sf, sf); 1661 sf, sf);
1660 vp9_find_mv_refs(cm, xd, tile_info, xd->mi[0], ref_frame, 1662 vp9_find_mv_refs(cm, xd, tile_info, xd->mi[0], ref_frame,
1661 candidates, mi_row, mi_col, NULL, NULL); 1663 candidates, mi_row, mi_col, NULL, NULL,
1664 xd->mi[0]->mbmi.mode_context);
1662 1665
1663 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, 1666 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates,
1664 &dummy_mv[0], &dummy_mv[1]); 1667 &dummy_mv[0], &dummy_mv[1]);
1665 } else { 1668 } else {
1666 ref_frame_skip_mask |= (1 << ref_frame); 1669 ref_frame_skip_mask |= (1 << ref_frame);
1667 } 1670 }
1668 } 1671 }
1669 1672
1670 mbmi->sb_type = bsize; 1673 mbmi->sb_type = bsize;
1671 mbmi->tx_size = TX_4X4; 1674 mbmi->tx_size = TX_4X4;
(...skipping 11 matching lines...) Expand all
1683 continue; 1686 continue;
1684 1687
1685 // TODO(jingning, agrange): Scaling reference frame not supported for 1688 // TODO(jingning, agrange): Scaling reference frame not supported for
1686 // sub8x8 blocks. Is this supported now? 1689 // sub8x8 blocks. Is this supported now?
1687 if (ref_frame > INTRA_FRAME && 1690 if (ref_frame > INTRA_FRAME &&
1688 vp9_is_scaled(&cm->frame_refs[ref_frame - 1].sf)) 1691 vp9_is_scaled(&cm->frame_refs[ref_frame - 1].sf))
1689 continue; 1692 continue;
1690 1693
1691 // If the segment reference frame feature is enabled.... 1694 // If the segment reference frame feature is enabled....
1692 // then do nothing if the current ref frame is not allowed.. 1695 // then do nothing if the current ref frame is not allowed..
1693 if (vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME) && 1696 if (segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME) &&
1694 vp9_get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame) 1697 get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame)
1695 continue; 1698 continue;
1696 1699
1697 mbmi->ref_frame[0] = ref_frame; 1700 mbmi->ref_frame[0] = ref_frame;
1698 x->skip = 0; 1701 x->skip = 0;
1699 set_ref_ptrs(cm, xd, ref_frame, second_ref_frame); 1702 set_ref_ptrs(cm, xd, ref_frame, second_ref_frame);
1700 1703
1701 // Select prediction reference frames. 1704 // Select prediction reference frames.
1702 for (plane = 0; plane < MAX_MB_PLANE; plane++) 1705 for (plane = 0; plane < MAX_MB_PLANE; plane++)
1703 xd->plane[plane].pre[0] = yv12_mb[ref_frame][plane]; 1706 xd->plane[plane].pre[0] = yv12_mb[ref_frame][plane];
1704 1707
(...skipping 20 matching lines...) Expand all
1725 pd->dst.buf = 1728 pd->dst.buf =
1726 &pd->dst.buf[vp9_raster_block_offset(BLOCK_8X8, i, pd->dst.stride)]; 1729 &pd->dst.buf[vp9_raster_block_offset(BLOCK_8X8, i, pd->dst.stride)];
1727 pd->pre[0].buf = 1730 pd->pre[0].buf =
1728 &pd->pre[0].buf[vp9_raster_block_offset(BLOCK_8X8, 1731 &pd->pre[0].buf[vp9_raster_block_offset(BLOCK_8X8,
1729 i, pd->pre[0].stride)]; 1732 i, pd->pre[0].stride)];
1730 1733
1731 b_mv[ZEROMV].as_int = 0; 1734 b_mv[ZEROMV].as_int = 0;
1732 b_mv[NEWMV].as_int = INVALID_MV; 1735 b_mv[NEWMV].as_int = INVALID_MV;
1733 vp9_append_sub8x8_mvs_for_idx(cm, xd, tile_info, i, 0, mi_row, mi_col, 1736 vp9_append_sub8x8_mvs_for_idx(cm, xd, tile_info, i, 0, mi_row, mi_col,
1734 &b_mv[NEARESTMV], 1737 &b_mv[NEARESTMV],
1735 &b_mv[NEARMV]); 1738 &b_mv[NEARMV],
1739 xd->mi[0]->mbmi.mode_context);
1736 1740
1737 for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { 1741 for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
1738 int b_rate = 0; 1742 int b_rate = 0;
1739 xd->mi[0]->bmi[i].as_mv[0].as_int = b_mv[this_mode].as_int; 1743 xd->mi[0]->bmi[i].as_mv[0].as_int = b_mv[this_mode].as_int;
1740 1744
1741 if (this_mode == NEWMV) { 1745 if (this_mode == NEWMV) {
1742 const int step_param = cpi->sf.mv.fullpel_search_step_param; 1746 const int step_param = cpi->sf.mv.fullpel_search_step_param;
1743 MV mvp_full; 1747 MV mvp_full;
1744 MV tmp_mv; 1748 MV tmp_mv;
1745 int cost_list[5]; 1749 int cost_list[5];
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 xd->mi[0]->bmi[block + 2] = bsi[best_ref_frame][block]; 1880 xd->mi[0]->bmi[block + 2] = bsi[best_ref_frame][block];
1877 } 1881 }
1878 } 1882 }
1879 mbmi->mode = xd->mi[0]->bmi[3].as_mode; 1883 mbmi->mode = xd->mi[0]->bmi[3].as_mode;
1880 ctx->mic = *(xd->mi[0]); 1884 ctx->mic = *(xd->mi[0]);
1881 ctx->skip_txfm[0] = 0; 1885 ctx->skip_txfm[0] = 0;
1882 ctx->skip = 0; 1886 ctx->skip = 0;
1883 // Dummy assignment for speed -5. No effect in speed -6. 1887 // Dummy assignment for speed -5. No effect in speed -6.
1884 rd_cost->rdcost = best_rd; 1888 rd_cost->rdcost = best_rd;
1885 } 1889 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_mcomp.c ('k') | source/libvpx/vp9/encoder/vp9_quantize.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698