| 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 |
| 11 #include <limits.h> | 11 #include <limits.h> |
| 12 #include <math.h> | 12 #include <math.h> |
| 13 #include <stdio.h> | 13 #include <stdio.h> |
| 14 | 14 |
| 15 #include "./vp9_rtcd.h" | 15 #include "./vp9_rtcd.h" |
| 16 #include "./vpx_dsp_rtcd.h" | 16 #include "./vpx_dsp_rtcd.h" |
| 17 #include "./vpx_config.h" | 17 #include "./vpx_config.h" |
| 18 | 18 |
| 19 #include "vpx_ports/mem.h" | 19 #include "vpx_ports/mem.h" |
| 20 #include "vpx_ports/vpx_timer.h" | 20 #include "vpx_ports/vpx_timer.h" |
| 21 #include "vpx_ports/system_state.h" |
| 21 | 22 |
| 22 #include "vp9/common/vp9_common.h" | 23 #include "vp9/common/vp9_common.h" |
| 23 #include "vp9/common/vp9_entropy.h" | 24 #include "vp9/common/vp9_entropy.h" |
| 24 #include "vp9/common/vp9_entropymode.h" | 25 #include "vp9/common/vp9_entropymode.h" |
| 25 #include "vp9/common/vp9_idct.h" | 26 #include "vp9/common/vp9_idct.h" |
| 26 #include "vp9/common/vp9_mvref_common.h" | 27 #include "vp9/common/vp9_mvref_common.h" |
| 27 #include "vp9/common/vp9_pred_common.h" | 28 #include "vp9/common/vp9_pred_common.h" |
| 28 #include "vp9/common/vp9_quant_common.h" | 29 #include "vp9/common/vp9_quant_common.h" |
| 29 #include "vp9/common/vp9_reconintra.h" | 30 #include "vp9/common/vp9_reconintra.h" |
| 30 #include "vp9/common/vp9_reconinter.h" | 31 #include "vp9/common/vp9_reconinter.h" |
| 31 #include "vp9/common/vp9_seg_common.h" | 32 #include "vp9/common/vp9_seg_common.h" |
| 32 #include "vp9/common/vp9_systemdependent.h" | |
| 33 #include "vp9/common/vp9_tile_common.h" | 33 #include "vp9/common/vp9_tile_common.h" |
| 34 | 34 |
| 35 #include "vp9/encoder/vp9_aq_complexity.h" | 35 #include "vp9/encoder/vp9_aq_complexity.h" |
| 36 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" | 36 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
| 37 #include "vp9/encoder/vp9_aq_variance.h" | 37 #include "vp9/encoder/vp9_aq_variance.h" |
| 38 #include "vp9/encoder/vp9_encodeframe.h" | 38 #include "vp9/encoder/vp9_encodeframe.h" |
| 39 #include "vp9/encoder/vp9_encodemb.h" | 39 #include "vp9/encoder/vp9_encodemb.h" |
| 40 #include "vp9/encoder/vp9_encodemv.h" | 40 #include "vp9/encoder/vp9_encodemv.h" |
| 41 #include "vp9/encoder/vp9_ethread.h" | 41 #include "vp9/encoder/vp9_ethread.h" |
| 42 #include "vp9/encoder/vp9_extend.h" | 42 #include "vp9/encoder/vp9_extend.h" |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 + (mi_col + 4 < cm->mi_cols) * 2 + (mi_row + 4 < cm->mi_rows); | 710 + (mi_col + 4 < cm->mi_cols) * 2 + (mi_row + 4 < cm->mi_rows); |
| 711 | 711 |
| 712 assert(yv12 != NULL); | 712 assert(yv12 != NULL); |
| 713 | 713 |
| 714 if (!(is_one_pass_cbr_svc(cpi) && cpi->svc.spatial_layer_id)) { | 714 if (!(is_one_pass_cbr_svc(cpi) && cpi->svc.spatial_layer_id)) { |
| 715 // For now, GOLDEN will not be used for non-zero spatial layers, since | 715 // For now, GOLDEN will not be used for non-zero spatial layers, since |
| 716 // it may not be a temporal reference. | 716 // it may not be a temporal reference. |
| 717 yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME); | 717 yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME); |
| 718 } | 718 } |
| 719 | 719 |
| 720 if (yv12_g && yv12_g != yv12) { | 720 if (yv12_g && yv12_g != yv12 && |
| 721 (cpi->ref_frame_flags & VP9_GOLD_FLAG)) { |
| 721 vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col, | 722 vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col, |
| 722 &cm->frame_refs[GOLDEN_FRAME - 1].sf); | 723 &cm->frame_refs[GOLDEN_FRAME - 1].sf); |
| 723 y_sad_g = cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, | 724 y_sad_g = cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, |
| 724 x->plane[0].src.stride, | 725 x->plane[0].src.stride, |
| 725 xd->plane[0].pre[0].buf, | 726 xd->plane[0].pre[0].buf, |
| 726 xd->plane[0].pre[0].stride); | 727 xd->plane[0].pre[0].stride); |
| 727 } else { | 728 } else { |
| 728 y_sad_g = UINT_MAX; | 729 y_sad_g = UINT_MAX; |
| 729 } | 730 } |
| 730 | 731 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 MACROBLOCK *const x = &td->mb; | 972 MACROBLOCK *const x = &td->mb; |
| 972 MACROBLOCKD *const xd = &x->e_mbd; | 973 MACROBLOCKD *const xd = &x->e_mbd; |
| 973 struct macroblock_plane *const p = x->plane; | 974 struct macroblock_plane *const p = x->plane; |
| 974 struct macroblockd_plane *const pd = xd->plane; | 975 struct macroblockd_plane *const pd = xd->plane; |
| 975 MODE_INFO *mi = &ctx->mic; | 976 MODE_INFO *mi = &ctx->mic; |
| 976 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 977 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; |
| 977 MODE_INFO *mi_addr = xd->mi[0]; | 978 MODE_INFO *mi_addr = xd->mi[0]; |
| 978 const struct segmentation *const seg = &cm->seg; | 979 const struct segmentation *const seg = &cm->seg; |
| 979 const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; | 980 const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; |
| 980 const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; | 981 const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; |
| 981 const int x_mis = MIN(bw, cm->mi_cols - mi_col); | 982 const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col); |
| 982 const int y_mis = MIN(bh, cm->mi_rows - mi_row); | 983 const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row); |
| 983 MV_REF *const frame_mvs = | 984 MV_REF *const frame_mvs = |
| 984 cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col; | 985 cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col; |
| 985 int w, h; | 986 int w, h; |
| 986 | 987 |
| 987 const int mis = cm->mi_stride; | 988 const int mis = cm->mi_stride; |
| 988 const int mi_width = num_8x8_blocks_wide_lookup[bsize]; | 989 const int mi_width = num_8x8_blocks_wide_lookup[bsize]; |
| 989 const int mi_height = num_8x8_blocks_high_lookup[bsize]; | 990 const int mi_height = num_8x8_blocks_high_lookup[bsize]; |
| 990 int max_plane; | 991 int max_plane; |
| 991 | 992 |
| 992 assert(mi->mbmi.sb_type == bsize); | 993 assert(mi->mbmi.sb_type == bsize); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 if (cpi->oxcf.aq_mode) | 1040 if (cpi->oxcf.aq_mode) |
| 1040 vp9_init_plane_quantizers(cpi, x); | 1041 vp9_init_plane_quantizers(cpi, x); |
| 1041 | 1042 |
| 1042 if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) { | 1043 if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) { |
| 1043 mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; | 1044 mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; |
| 1044 mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int; | 1045 mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int; |
| 1045 } | 1046 } |
| 1046 | 1047 |
| 1047 x->skip = ctx->skip; | 1048 x->skip = ctx->skip; |
| 1048 memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk, | 1049 memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk, |
| 1049 sizeof(uint8_t) * ctx->num_4x4_blk); | 1050 sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); |
| 1050 | 1051 |
| 1051 if (!output_enabled) | 1052 if (!output_enabled) |
| 1052 return; | 1053 return; |
| 1053 | 1054 |
| 1054 #if CONFIG_INTERNAL_STATS | 1055 #if CONFIG_INTERNAL_STATS |
| 1055 if (frame_is_intra_only(cm)) { | 1056 if (frame_is_intra_only(cm)) { |
| 1056 static const int kf_mode_index[] = { | 1057 static const int kf_mode_index[] = { |
| 1057 THR_DC /*DC_PRED*/, | 1058 THR_DC /*DC_PRED*/, |
| 1058 THR_V_PRED /*V_PRED*/, | 1059 THR_V_PRED /*V_PRED*/, |
| 1059 THR_H_PRED /*H_PRED*/, | 1060 THR_H_PRED /*H_PRED*/, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 | 1125 |
| 1125 if (xd->up_available) | 1126 if (xd->up_available) |
| 1126 filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; | 1127 filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; |
| 1127 else if (xd->left_available) | 1128 else if (xd->left_available) |
| 1128 filter_ref = xd->mi[-1]->mbmi.interp_filter; | 1129 filter_ref = xd->mi[-1]->mbmi.interp_filter; |
| 1129 else | 1130 else |
| 1130 filter_ref = EIGHTTAP; | 1131 filter_ref = EIGHTTAP; |
| 1131 | 1132 |
| 1132 mbmi->sb_type = bsize; | 1133 mbmi->sb_type = bsize; |
| 1133 mbmi->mode = ZEROMV; | 1134 mbmi->mode = ZEROMV; |
| 1134 mbmi->tx_size = MIN(max_txsize_lookup[bsize], | 1135 mbmi->tx_size = |
| 1135 tx_mode_to_biggest_tx_size[tx_mode]); | 1136 VPXMIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[tx_mode]); |
| 1136 mbmi->skip = 1; | 1137 mbmi->skip = 1; |
| 1137 mbmi->uv_mode = DC_PRED; | 1138 mbmi->uv_mode = DC_PRED; |
| 1138 mbmi->ref_frame[0] = LAST_FRAME; | 1139 mbmi->ref_frame[0] = LAST_FRAME; |
| 1139 mbmi->ref_frame[1] = NONE; | 1140 mbmi->ref_frame[1] = NONE; |
| 1140 mbmi->mv[0].as_int = 0; | 1141 mbmi->mv[0].as_int = 0; |
| 1141 mbmi->interp_filter = filter_ref; | 1142 mbmi->interp_filter = filter_ref; |
| 1142 | 1143 |
| 1143 xd->mi[0]->bmi[0].as_mv[0].as_int = 0; | 1144 xd->mi[0]->bmi[0].as_mv[0].as_int = 0; |
| 1144 x->skip = 1; | 1145 x->skip = 1; |
| 1145 | 1146 |
| 1146 vp9_rd_cost_init(rd_cost); | 1147 vp9_rd_cost_init(rd_cost); |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 static int set_segment_rdmult(VP9_COMP *const cpi, | 1150 static int set_segment_rdmult(VP9_COMP *const cpi, |
| 1150 MACROBLOCK *const x, | 1151 MACROBLOCK *const x, |
| 1151 int8_t segment_id) { | 1152 int8_t segment_id) { |
| 1152 int segment_qindex; | 1153 int segment_qindex; |
| 1153 VP9_COMMON *const cm = &cpi->common; | 1154 VP9_COMMON *const cm = &cpi->common; |
| 1154 vp9_init_plane_quantizers(cpi, x); | 1155 vp9_init_plane_quantizers(cpi, x); |
| 1155 vp9_clear_system_state(); | 1156 vpx_clear_system_state(); |
| 1156 segment_qindex = vp9_get_qindex(&cm->seg, segment_id, | 1157 segment_qindex = vp9_get_qindex(&cm->seg, segment_id, |
| 1157 cm->base_qindex); | 1158 cm->base_qindex); |
| 1158 return vp9_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q); | 1159 return vp9_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q); |
| 1159 } | 1160 } |
| 1160 | 1161 |
| 1161 static void rd_pick_sb_modes(VP9_COMP *cpi, | 1162 static void rd_pick_sb_modes(VP9_COMP *cpi, |
| 1162 TileDataEnc *tile_data, | 1163 TileDataEnc *tile_data, |
| 1163 MACROBLOCK *const x, | 1164 MACROBLOCK *const x, |
| 1164 int mi_row, int mi_col, RD_COST *rd_cost, | 1165 int mi_row, int mi_col, RD_COST *rd_cost, |
| 1165 BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, | 1166 BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, |
| 1166 int64_t best_rd) { | 1167 int64_t best_rd) { |
| 1167 VP9_COMMON *const cm = &cpi->common; | 1168 VP9_COMMON *const cm = &cpi->common; |
| 1168 TileInfo *const tile_info = &tile_data->tile_info; | 1169 TileInfo *const tile_info = &tile_data->tile_info; |
| 1169 MACROBLOCKD *const xd = &x->e_mbd; | 1170 MACROBLOCKD *const xd = &x->e_mbd; |
| 1170 MB_MODE_INFO *mbmi; | 1171 MB_MODE_INFO *mbmi; |
| 1171 struct macroblock_plane *const p = x->plane; | 1172 struct macroblock_plane *const p = x->plane; |
| 1172 struct macroblockd_plane *const pd = xd->plane; | 1173 struct macroblockd_plane *const pd = xd->plane; |
| 1173 const AQ_MODE aq_mode = cpi->oxcf.aq_mode; | 1174 const AQ_MODE aq_mode = cpi->oxcf.aq_mode; |
| 1174 int i, orig_rdmult; | 1175 int i, orig_rdmult; |
| 1175 | 1176 |
| 1176 vp9_clear_system_state(); | 1177 vpx_clear_system_state(); |
| 1177 | 1178 |
| 1178 // Use the lower precision, but faster, 32x32 fdct for mode selection. | 1179 // Use the lower precision, but faster, 32x32 fdct for mode selection. |
| 1179 x->use_lp32x32fdct = 1; | 1180 x->use_lp32x32fdct = 1; |
| 1180 | 1181 |
| 1181 set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize); | 1182 set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize); |
| 1182 mbmi = &xd->mi[0]->mbmi; | 1183 mbmi = &xd->mi[0]->mbmi; |
| 1183 mbmi->sb_type = bsize; | 1184 mbmi->sb_type = bsize; |
| 1184 | 1185 |
| 1185 for (i = 0; i < MAX_MB_PLANE; ++i) { | 1186 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 1186 p[i].coeff = ctx->coeff_pbuf[i][0]; | 1187 p[i].coeff = ctx->coeff_pbuf[i][0]; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 update_partition_context(xd, mi_row, mi_col, subsize, bsize); | 1489 update_partition_context(xd, mi_row, mi_col, subsize, bsize); |
| 1489 } | 1490 } |
| 1490 | 1491 |
| 1491 // Check to see if the given partition size is allowed for a specified number | 1492 // Check to see if the given partition size is allowed for a specified number |
| 1492 // of 8x8 block rows and columns remaining in the image. | 1493 // of 8x8 block rows and columns remaining in the image. |
| 1493 // If not then return the largest allowed partition size | 1494 // If not then return the largest allowed partition size |
| 1494 static BLOCK_SIZE find_partition_size(BLOCK_SIZE bsize, | 1495 static BLOCK_SIZE find_partition_size(BLOCK_SIZE bsize, |
| 1495 int rows_left, int cols_left, | 1496 int rows_left, int cols_left, |
| 1496 int *bh, int *bw) { | 1497 int *bh, int *bw) { |
| 1497 if (rows_left <= 0 || cols_left <= 0) { | 1498 if (rows_left <= 0 || cols_left <= 0) { |
| 1498 return MIN(bsize, BLOCK_8X8); | 1499 return VPXMIN(bsize, BLOCK_8X8); |
| 1499 } else { | 1500 } else { |
| 1500 for (; bsize > 0; bsize -= 3) { | 1501 for (; bsize > 0; bsize -= 3) { |
| 1501 *bh = num_8x8_blocks_high_lookup[bsize]; | 1502 *bh = num_8x8_blocks_high_lookup[bsize]; |
| 1502 *bw = num_8x8_blocks_wide_lookup[bsize]; | 1503 *bw = num_8x8_blocks_wide_lookup[bsize]; |
| 1503 if ((*bh <= rows_left) && (*bw <= cols_left)) { | 1504 if ((*bh <= rows_left) && (*bw <= cols_left)) { |
| 1504 break; | 1505 break; |
| 1505 } | 1506 } |
| 1506 } | 1507 } |
| 1507 } | 1508 } |
| 1508 return bsize; | 1509 return bsize; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 PICK_MODE_CONTEXT *ctx, | 1665 PICK_MODE_CONTEXT *ctx, |
| 1665 int mi_row, int mi_col, int bsize) { | 1666 int mi_row, int mi_col, int bsize) { |
| 1666 VP9_COMMON *const cm = &cpi->common; | 1667 VP9_COMMON *const cm = &cpi->common; |
| 1667 MACROBLOCK *const x = &td->mb; | 1668 MACROBLOCK *const x = &td->mb; |
| 1668 MACROBLOCKD *const xd = &x->e_mbd; | 1669 MACROBLOCKD *const xd = &x->e_mbd; |
| 1669 MODE_INFO *const mi = xd->mi[0]; | 1670 MODE_INFO *const mi = xd->mi[0]; |
| 1670 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 1671 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; |
| 1671 const struct segmentation *const seg = &cm->seg; | 1672 const struct segmentation *const seg = &cm->seg; |
| 1672 const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; | 1673 const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; |
| 1673 const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; | 1674 const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; |
| 1674 const int x_mis = MIN(bw, cm->mi_cols - mi_col); | 1675 const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col); |
| 1675 const int y_mis = MIN(bh, cm->mi_rows - mi_row); | 1676 const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row); |
| 1676 | 1677 |
| 1677 *(xd->mi[0]) = ctx->mic; | 1678 *(xd->mi[0]) = ctx->mic; |
| 1678 *(x->mbmi_ext) = ctx->mbmi_ext; | 1679 *(x->mbmi_ext) = ctx->mbmi_ext; |
| 1679 | 1680 |
| 1680 if (seg->enabled && cpi->oxcf.aq_mode) { | 1681 if (seg->enabled && cpi->oxcf.aq_mode) { |
| 1681 // For in frame complexity AQ or variance AQ, copy segment_id from | 1682 // For in frame complexity AQ or variance AQ, copy segment_id from |
| 1682 // segmentation_map. | 1683 // segmentation_map. |
| 1683 if (cpi->oxcf.aq_mode == COMPLEXITY_AQ || | 1684 if (cpi->oxcf.aq_mode == COMPLEXITY_AQ || |
| 1684 cpi->oxcf.aq_mode == VARIANCE_AQ ) { | 1685 cpi->oxcf.aq_mode == VARIANCE_AQ ) { |
| 1685 const uint8_t *const map = seg->update_map ? cpi->segmentation_map | 1686 const uint8_t *const map = seg->update_map ? cpi->segmentation_map |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 int output_enabled, BLOCK_SIZE bsize, | 1734 int output_enabled, BLOCK_SIZE bsize, |
| 1734 PICK_MODE_CONTEXT *ctx) { | 1735 PICK_MODE_CONTEXT *ctx) { |
| 1735 MACROBLOCK *const x = &td->mb; | 1736 MACROBLOCK *const x = &td->mb; |
| 1736 set_offsets(cpi, tile, x, mi_row, mi_col, bsize); | 1737 set_offsets(cpi, tile, x, mi_row, mi_col, bsize); |
| 1737 update_state_rt(cpi, td, ctx, mi_row, mi_col, bsize); | 1738 update_state_rt(cpi, td, ctx, mi_row, mi_col, bsize); |
| 1738 | 1739 |
| 1739 #if CONFIG_VP9_TEMPORAL_DENOISING | 1740 #if CONFIG_VP9_TEMPORAL_DENOISING |
| 1740 if (cpi->oxcf.noise_sensitivity > 0 && output_enabled && | 1741 if (cpi->oxcf.noise_sensitivity > 0 && output_enabled && |
| 1741 cpi->common.frame_type != KEY_FRAME) { | 1742 cpi->common.frame_type != KEY_FRAME) { |
| 1742 vp9_denoiser_denoise(&cpi->denoiser, x, mi_row, mi_col, | 1743 vp9_denoiser_denoise(&cpi->denoiser, x, mi_row, mi_col, |
| 1743 MAX(BLOCK_8X8, bsize), ctx); | 1744 VPXMAX(BLOCK_8X8, bsize), ctx); |
| 1744 } | 1745 } |
| 1745 #endif | 1746 #endif |
| 1746 | 1747 |
| 1747 encode_superblock(cpi, td, tp, output_enabled, mi_row, mi_col, bsize, ctx); | 1748 encode_superblock(cpi, td, tp, output_enabled, mi_row, mi_col, bsize, ctx); |
| 1748 update_stats(&cpi->common, td); | 1749 update_stats(&cpi->common, td); |
| 1749 | 1750 |
| 1750 (*tp)->token = EOSB_TOKEN; | 1751 (*tp)->token = EOSB_TOKEN; |
| 1751 (*tp)++; | 1752 (*tp)++; |
| 1752 } | 1753 } |
| 1753 | 1754 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 int sb_height_in_blocks = MI_BLOCK_SIZE; | 2126 int sb_height_in_blocks = MI_BLOCK_SIZE; |
| 2126 int i, j; | 2127 int i, j; |
| 2127 int index = 0; | 2128 int index = 0; |
| 2128 | 2129 |
| 2129 // Check the sb_type for each block that belongs to this region. | 2130 // Check the sb_type for each block that belongs to this region. |
| 2130 for (i = 0; i < sb_height_in_blocks; ++i) { | 2131 for (i = 0; i < sb_height_in_blocks; ++i) { |
| 2131 for (j = 0; j < sb_width_in_blocks; ++j) { | 2132 for (j = 0; j < sb_width_in_blocks; ++j) { |
| 2132 MODE_INFO *mi = mi_8x8[index+j]; | 2133 MODE_INFO *mi = mi_8x8[index+j]; |
| 2133 BLOCK_SIZE sb_type = mi ? mi->mbmi.sb_type : 0; | 2134 BLOCK_SIZE sb_type = mi ? mi->mbmi.sb_type : 0; |
| 2134 bs_hist[sb_type]++; | 2135 bs_hist[sb_type]++; |
| 2135 *min_block_size = MIN(*min_block_size, sb_type); | 2136 *min_block_size = VPXMIN(*min_block_size, sb_type); |
| 2136 *max_block_size = MAX(*max_block_size, sb_type); | 2137 *max_block_size = VPXMAX(*max_block_size, sb_type); |
| 2137 } | 2138 } |
| 2138 index += xd->mi_stride; | 2139 index += xd->mi_stride; |
| 2139 } | 2140 } |
| 2140 } | 2141 } |
| 2141 | 2142 |
| 2142 // Next square block size less or equal than current block size. | 2143 // Next square block size less or equal than current block size. |
| 2143 static const BLOCK_SIZE next_square_size[BLOCK_SIZES] = { | 2144 static const BLOCK_SIZE next_square_size[BLOCK_SIZES] = { |
| 2144 BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, | 2145 BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, |
| 2145 BLOCK_8X8, BLOCK_8X8, BLOCK_8X8, | 2146 BLOCK_8X8, BLOCK_8X8, BLOCK_8X8, |
| 2146 BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, | 2147 BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 // Check border cases where max and min from neighbors may not be legal. | 2204 // Check border cases where max and min from neighbors may not be legal. |
| 2204 max_size = find_partition_size(max_size, | 2205 max_size = find_partition_size(max_size, |
| 2205 row8x8_remaining, col8x8_remaining, | 2206 row8x8_remaining, col8x8_remaining, |
| 2206 &bh, &bw); | 2207 &bh, &bw); |
| 2207 // Test for blocks at the edge of the active image. | 2208 // Test for blocks at the edge of the active image. |
| 2208 // This may be the actual edge of the image or where there are formatting | 2209 // This may be the actual edge of the image or where there are formatting |
| 2209 // bars. | 2210 // bars. |
| 2210 if (vp9_active_edge_sb(cpi, mi_row, mi_col)) { | 2211 if (vp9_active_edge_sb(cpi, mi_row, mi_col)) { |
| 2211 min_size = BLOCK_4X4; | 2212 min_size = BLOCK_4X4; |
| 2212 } else { | 2213 } else { |
| 2213 min_size = MIN(cpi->sf.rd_auto_partition_min_limit, | 2214 min_size = |
| 2214 MIN(min_size, max_size)); | 2215 VPXMIN(cpi->sf.rd_auto_partition_min_limit, VPXMIN(min_size, max_size)); |
| 2215 } | 2216 } |
| 2216 | 2217 |
| 2217 // When use_square_partition_only is true, make sure at least one square | 2218 // When use_square_partition_only is true, make sure at least one square |
| 2218 // partition is allowed by selecting the next smaller square size as | 2219 // partition is allowed by selecting the next smaller square size as |
| 2219 // *min_block_size. | 2220 // *min_block_size. |
| 2220 if (cpi->sf.use_square_partition_only && | 2221 if (cpi->sf.use_square_partition_only && |
| 2221 next_square_size[max_size] < min_size) { | 2222 next_square_size[max_size] < min_size) { |
| 2222 min_size = next_square_size[max_size]; | 2223 min_size = next_square_size[max_size]; |
| 2223 } | 2224 } |
| 2224 | 2225 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2240 BLOCK_SIZE bs, min_size, max_size; | 2241 BLOCK_SIZE bs, min_size, max_size; |
| 2241 | 2242 |
| 2242 min_size = BLOCK_64X64; | 2243 min_size = BLOCK_64X64; |
| 2243 max_size = BLOCK_4X4; | 2244 max_size = BLOCK_4X4; |
| 2244 | 2245 |
| 2245 if (prev_mi) { | 2246 if (prev_mi) { |
| 2246 for (idy = 0; idy < mi_height; ++idy) { | 2247 for (idy = 0; idy < mi_height; ++idy) { |
| 2247 for (idx = 0; idx < mi_width; ++idx) { | 2248 for (idx = 0; idx < mi_width; ++idx) { |
| 2248 mi = prev_mi[idy * cm->mi_stride + idx]; | 2249 mi = prev_mi[idy * cm->mi_stride + idx]; |
| 2249 bs = mi ? mi->mbmi.sb_type : bsize; | 2250 bs = mi ? mi->mbmi.sb_type : bsize; |
| 2250 min_size = MIN(min_size, bs); | 2251 min_size = VPXMIN(min_size, bs); |
| 2251 max_size = MAX(max_size, bs); | 2252 max_size = VPXMAX(max_size, bs); |
| 2252 } | 2253 } |
| 2253 } | 2254 } |
| 2254 } | 2255 } |
| 2255 | 2256 |
| 2256 if (xd->left_available) { | 2257 if (xd->left_available) { |
| 2257 for (idy = 0; idy < mi_height; ++idy) { | 2258 for (idy = 0; idy < mi_height; ++idy) { |
| 2258 mi = xd->mi[idy * cm->mi_stride - 1]; | 2259 mi = xd->mi[idy * cm->mi_stride - 1]; |
| 2259 bs = mi ? mi->mbmi.sb_type : bsize; | 2260 bs = mi ? mi->mbmi.sb_type : bsize; |
| 2260 min_size = MIN(min_size, bs); | 2261 min_size = VPXMIN(min_size, bs); |
| 2261 max_size = MAX(max_size, bs); | 2262 max_size = VPXMAX(max_size, bs); |
| 2262 } | 2263 } |
| 2263 } | 2264 } |
| 2264 | 2265 |
| 2265 if (xd->up_available) { | 2266 if (xd->up_available) { |
| 2266 for (idx = 0; idx < mi_width; ++idx) { | 2267 for (idx = 0; idx < mi_width; ++idx) { |
| 2267 mi = xd->mi[idx - cm->mi_stride]; | 2268 mi = xd->mi[idx - cm->mi_stride]; |
| 2268 bs = mi ? mi->mbmi.sb_type : bsize; | 2269 bs = mi ? mi->mbmi.sb_type : bsize; |
| 2269 min_size = MIN(min_size, bs); | 2270 min_size = VPXMIN(min_size, bs); |
| 2270 max_size = MAX(max_size, bs); | 2271 max_size = VPXMAX(max_size, bs); |
| 2271 } | 2272 } |
| 2272 } | 2273 } |
| 2273 | 2274 |
| 2274 if (min_size == max_size) { | 2275 if (min_size == max_size) { |
| 2275 min_size = min_partition_size[min_size]; | 2276 min_size = min_partition_size[min_size]; |
| 2276 max_size = max_partition_size[max_size]; | 2277 max_size = max_partition_size[max_size]; |
| 2277 } | 2278 } |
| 2278 | 2279 |
| 2279 *min_bs = min_size; | 2280 *min_bs = min_size; |
| 2280 *max_bs = max_size; | 2281 *max_bs = max_size; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 | 2426 |
| 2426 #if CONFIG_FP_MB_STATS | 2427 #if CONFIG_FP_MB_STATS |
| 2427 // Decide whether we shall split directly and skip searching NONE by using | 2428 // Decide whether we shall split directly and skip searching NONE by using |
| 2428 // the first pass block statistics | 2429 // the first pass block statistics |
| 2429 if (cpi->use_fp_mb_stats && bsize >= BLOCK_32X32 && do_split && | 2430 if (cpi->use_fp_mb_stats && bsize >= BLOCK_32X32 && do_split && |
| 2430 partition_none_allowed && src_diff_var > 4 && | 2431 partition_none_allowed && src_diff_var > 4 && |
| 2431 cm->base_qindex < qindex_split_threshold_lookup[bsize]) { | 2432 cm->base_qindex < qindex_split_threshold_lookup[bsize]) { |
| 2432 int mb_row = mi_row >> 1; | 2433 int mb_row = mi_row >> 1; |
| 2433 int mb_col = mi_col >> 1; | 2434 int mb_col = mi_col >> 1; |
| 2434 int mb_row_end = | 2435 int mb_row_end = |
| 2435 MIN(mb_row + num_16x16_blocks_high_lookup[bsize], cm->mb_rows); | 2436 VPXMIN(mb_row + num_16x16_blocks_high_lookup[bsize], cm->mb_rows); |
| 2436 int mb_col_end = | 2437 int mb_col_end = |
| 2437 MIN(mb_col + num_16x16_blocks_wide_lookup[bsize], cm->mb_cols); | 2438 VPXMIN(mb_col + num_16x16_blocks_wide_lookup[bsize], cm->mb_cols); |
| 2438 int r, c; | 2439 int r, c; |
| 2439 | 2440 |
| 2440 // compute a complexity measure, basically measure inconsistency of motion | 2441 // compute a complexity measure, basically measure inconsistency of motion |
| 2441 // vectors obtained from the first pass in the current block | 2442 // vectors obtained from the first pass in the current block |
| 2442 for (r = mb_row; r < mb_row_end ; r++) { | 2443 for (r = mb_row; r < mb_row_end ; r++) { |
| 2443 for (c = mb_col; c < mb_col_end; c++) { | 2444 for (c = mb_col; c < mb_col_end; c++) { |
| 2444 const int mb_index = r * cm->mb_cols + c; | 2445 const int mb_index = r * cm->mb_cols + c; |
| 2445 | 2446 |
| 2446 MOTION_DIRECTION this_mv; | 2447 MOTION_DIRECTION this_mv; |
| 2447 MOTION_DIRECTION right_mv; | 2448 MOTION_DIRECTION right_mv; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2516 // Check if every 16x16 first pass block statistics has zero | 2517 // Check if every 16x16 first pass block statistics has zero |
| 2517 // motion and the corresponding first pass residue is small enough. | 2518 // motion and the corresponding first pass residue is small enough. |
| 2518 // If that is the case, check the difference variance between the | 2519 // If that is the case, check the difference variance between the |
| 2519 // current frame and the last frame. If the variance is small enough, | 2520 // current frame and the last frame. If the variance is small enough, |
| 2520 // stop further splitting in RD optimization | 2521 // stop further splitting in RD optimization |
| 2521 if (cpi->use_fp_mb_stats && do_split != 0 && | 2522 if (cpi->use_fp_mb_stats && do_split != 0 && |
| 2522 cm->base_qindex > qindex_skip_threshold_lookup[bsize]) { | 2523 cm->base_qindex > qindex_skip_threshold_lookup[bsize]) { |
| 2523 int mb_row = mi_row >> 1; | 2524 int mb_row = mi_row >> 1; |
| 2524 int mb_col = mi_col >> 1; | 2525 int mb_col = mi_col >> 1; |
| 2525 int mb_row_end = | 2526 int mb_row_end = |
| 2526 MIN(mb_row + num_16x16_blocks_high_lookup[bsize], cm->mb_rows); | 2527 VPXMIN(mb_row + num_16x16_blocks_high_lookup[bsize], cm->mb_rows); |
| 2527 int mb_col_end = | 2528 int mb_col_end = |
| 2528 MIN(mb_col + num_16x16_blocks_wide_lookup[bsize], cm->mb_cols); | 2529 VPXMIN(mb_col + num_16x16_blocks_wide_lookup[bsize], cm->mb_cols); |
| 2529 int r, c; | 2530 int r, c; |
| 2530 | 2531 |
| 2531 int skip = 1; | 2532 int skip = 1; |
| 2532 for (r = mb_row; r < mb_row_end; r++) { | 2533 for (r = mb_row; r < mb_row_end; r++) { |
| 2533 for (c = mb_col; c < mb_col_end; c++) { | 2534 for (c = mb_col; c < mb_col_end; c++) { |
| 2534 const int mb_index = r * cm->mb_cols + c; | 2535 const int mb_index = r * cm->mb_cols + c; |
| 2535 if (!(cpi->twopass.this_frame_mb_stats[mb_index] & | 2536 if (!(cpi->twopass.this_frame_mb_stats[mb_index] & |
| 2536 FPMB_MOTION_ZERO_MASK) || | 2537 FPMB_MOTION_ZERO_MASK) || |
| 2537 !(cpi->twopass.this_frame_mb_stats[mb_index] & | 2538 !(cpi->twopass.this_frame_mb_stats[mb_index] & |
| 2538 FPMB_ERROR_SMALL_MASK)) { | 2539 FPMB_ERROR_SMALL_MASK)) { |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3638 static int set_var_thresh_from_histogram(VP9_COMP *cpi) { | 3639 static int set_var_thresh_from_histogram(VP9_COMP *cpi) { |
| 3639 const SPEED_FEATURES *const sf = &cpi->sf; | 3640 const SPEED_FEATURES *const sf = &cpi->sf; |
| 3640 const VP9_COMMON *const cm = &cpi->common; | 3641 const VP9_COMMON *const cm = &cpi->common; |
| 3641 | 3642 |
| 3642 const uint8_t *src = cpi->Source->y_buffer; | 3643 const uint8_t *src = cpi->Source->y_buffer; |
| 3643 const uint8_t *last_src = cpi->Last_Source->y_buffer; | 3644 const uint8_t *last_src = cpi->Last_Source->y_buffer; |
| 3644 const int src_stride = cpi->Source->y_stride; | 3645 const int src_stride = cpi->Source->y_stride; |
| 3645 const int last_stride = cpi->Last_Source->y_stride; | 3646 const int last_stride = cpi->Last_Source->y_stride; |
| 3646 | 3647 |
| 3647 // Pick cutoff threshold | 3648 // Pick cutoff threshold |
| 3648 const int cutoff = (MIN(cm->width, cm->height) >= 720) ? | 3649 const int cutoff = (VPXMIN(cm->width, cm->height) >= 720) ? |
| 3649 (cm->MBs * VAR_HIST_LARGE_CUT_OFF / 100) : | 3650 (cm->MBs * VAR_HIST_LARGE_CUT_OFF / 100) : |
| 3650 (cm->MBs * VAR_HIST_SMALL_CUT_OFF / 100); | 3651 (cm->MBs * VAR_HIST_SMALL_CUT_OFF / 100); |
| 3651 DECLARE_ALIGNED(16, int, hist[VAR_HIST_BINS]); | 3652 DECLARE_ALIGNED(16, int, hist[VAR_HIST_BINS]); |
| 3652 diff *var16 = cpi->source_diff_var; | 3653 diff *var16 = cpi->source_diff_var; |
| 3653 | 3654 |
| 3654 int sum = 0; | 3655 int sum = 0; |
| 3655 int i, j; | 3656 int i, j; |
| 3656 | 3657 |
| 3657 memset(hist, 0, VAR_HIST_BINS * sizeof(hist[0])); | 3658 memset(hist, 0, VAR_HIST_BINS * sizeof(hist[0])); |
| 3658 | 3659 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3918 PICK_MODE_CONTEXT *ctx = &cpi->td.pc_root->none; | 3919 PICK_MODE_CONTEXT *ctx = &cpi->td.pc_root->none; |
| 3919 | 3920 |
| 3920 for (i = 0; i < MAX_MB_PLANE; ++i) { | 3921 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 3921 p[i].coeff = ctx->coeff_pbuf[i][0]; | 3922 p[i].coeff = ctx->coeff_pbuf[i][0]; |
| 3922 p[i].qcoeff = ctx->qcoeff_pbuf[i][0]; | 3923 p[i].qcoeff = ctx->qcoeff_pbuf[i][0]; |
| 3923 pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0]; | 3924 pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0]; |
| 3924 p[i].eobs = ctx->eobs_pbuf[i][0]; | 3925 p[i].eobs = ctx->eobs_pbuf[i][0]; |
| 3925 } | 3926 } |
| 3926 vp9_zero(x->zcoeff_blk); | 3927 vp9_zero(x->zcoeff_blk); |
| 3927 | 3928 |
| 3928 if (cm->frame_type != KEY_FRAME && cpi->rc.frames_since_golden == 0) | 3929 if (cm->frame_type != KEY_FRAME && |
| 3930 cpi->rc.frames_since_golden == 0 && |
| 3931 !cpi->use_svc) |
| 3929 cpi->ref_frame_flags &= (~VP9_GOLD_FLAG); | 3932 cpi->ref_frame_flags &= (~VP9_GOLD_FLAG); |
| 3930 | 3933 |
| 3931 if (sf->partition_search_type == SOURCE_VAR_BASED_PARTITION) | 3934 if (sf->partition_search_type == SOURCE_VAR_BASED_PARTITION) |
| 3932 source_var_based_partition_search_method(cpi); | 3935 source_var_based_partition_search_method(cpi); |
| 3933 } | 3936 } |
| 3934 | 3937 |
| 3935 { | 3938 { |
| 3936 struct vpx_usec_timer emr_timer; | 3939 struct vpx_usec_timer emr_timer; |
| 3937 vpx_usec_timer_start(&emr_timer); | 3940 vpx_usec_timer_start(&emr_timer); |
| 3938 | 3941 |
| 3939 #if CONFIG_FP_MB_STATS | 3942 #if CONFIG_FP_MB_STATS |
| 3940 if (cpi->use_fp_mb_stats) { | 3943 if (cpi->use_fp_mb_stats) { |
| 3941 input_fpmb_stats(&cpi->twopass.firstpass_mb_stats, cm, | 3944 input_fpmb_stats(&cpi->twopass.firstpass_mb_stats, cm, |
| 3942 &cpi->twopass.this_frame_mb_stats); | 3945 &cpi->twopass.this_frame_mb_stats); |
| 3943 } | 3946 } |
| 3944 #endif | 3947 #endif |
| 3945 | 3948 |
| 3946 // If allowed, encoding tiles in parallel with one thread handling one tile. | 3949 // If allowed, encoding tiles in parallel with one thread handling one tile. |
| 3947 if (MIN(cpi->oxcf.max_threads, 1 << cm->log2_tile_cols) > 1) | 3950 if (VPXMIN(cpi->oxcf.max_threads, 1 << cm->log2_tile_cols) > 1) |
| 3948 vp9_encode_tiles_mt(cpi); | 3951 vp9_encode_tiles_mt(cpi); |
| 3949 else | 3952 else |
| 3950 encode_tiles(cpi); | 3953 encode_tiles(cpi); |
| 3951 | 3954 |
| 3952 vpx_usec_timer_mark(&emr_timer); | 3955 vpx_usec_timer_mark(&emr_timer); |
| 3953 cpi->time_encode_sb_row += vpx_usec_timer_elapsed(&emr_timer); | 3956 cpi->time_encode_sb_row += vpx_usec_timer_elapsed(&emr_timer); |
| 3954 } | 3957 } |
| 3955 | 3958 |
| 3956 sf->skip_encode_frame = sf->skip_encode_sb ? | 3959 sf->skip_encode_frame = sf->skip_encode_sb ? |
| 3957 get_skip_encode_frame(cm, td) : 0; | 3960 get_skip_encode_frame(cm, td) : 0; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4148 | 4151 |
| 4149 x->skip_optimize = ctx->is_coded; | 4152 x->skip_optimize = ctx->is_coded; |
| 4150 ctx->is_coded = 1; | 4153 ctx->is_coded = 1; |
| 4151 x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct; | 4154 x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct; |
| 4152 x->skip_encode = (!output_enabled && cpi->sf.skip_encode_frame && | 4155 x->skip_encode = (!output_enabled && cpi->sf.skip_encode_frame && |
| 4153 x->q_index < QIDX_SKIP_THRESH); | 4156 x->q_index < QIDX_SKIP_THRESH); |
| 4154 | 4157 |
| 4155 if (x->skip_encode) | 4158 if (x->skip_encode) |
| 4156 return; | 4159 return; |
| 4157 | 4160 |
| 4158 set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); | |
| 4159 | |
| 4160 if (!is_inter_block(mbmi)) { | 4161 if (!is_inter_block(mbmi)) { |
| 4161 int plane; | 4162 int plane; |
| 4162 mbmi->skip = 1; | 4163 mbmi->skip = 1; |
| 4163 for (plane = 0; plane < MAX_MB_PLANE; ++plane) | 4164 for (plane = 0; plane < MAX_MB_PLANE; ++plane) |
| 4164 vp9_encode_intra_block_plane(x, MAX(bsize, BLOCK_8X8), plane); | 4165 vp9_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane); |
| 4165 if (output_enabled) | 4166 if (output_enabled) |
| 4166 sum_intra_stats(td->counts, mi); | 4167 sum_intra_stats(td->counts, mi); |
| 4167 vp9_tokenize_sb(cpi, td, t, !output_enabled, MAX(bsize, BLOCK_8X8)); | 4168 vp9_tokenize_sb(cpi, td, t, !output_enabled, VPXMAX(bsize, BLOCK_8X8)); |
| 4168 } else { | 4169 } else { |
| 4169 int ref; | 4170 int ref; |
| 4170 const int is_compound = has_second_ref(mbmi); | 4171 const int is_compound = has_second_ref(mbmi); |
| 4172 set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); |
| 4171 for (ref = 0; ref < 1 + is_compound; ++ref) { | 4173 for (ref = 0; ref < 1 + is_compound; ++ref) { |
| 4172 YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, | 4174 YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, |
| 4173 mbmi->ref_frame[ref]); | 4175 mbmi->ref_frame[ref]); |
| 4174 assert(cfg != NULL); | 4176 assert(cfg != NULL); |
| 4175 vp9_setup_pre_planes(xd, ref, cfg, mi_row, mi_col, | 4177 vp9_setup_pre_planes(xd, ref, cfg, mi_row, mi_col, |
| 4176 &xd->block_refs[ref]->sf); | 4178 &xd->block_refs[ref]->sf); |
| 4177 } | 4179 } |
| 4178 if (!(cpi->sf.reuse_inter_pred_sby && ctx->pred_pixel_ready) || seg_skip) | 4180 if (!(cpi->sf.reuse_inter_pred_sby && ctx->pred_pixel_ready) || seg_skip) |
| 4179 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, MAX(bsize, BLOCK_8X8)); | 4181 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, |
| 4182 VPXMAX(bsize, BLOCK_8X8)); |
| 4180 | 4183 |
| 4181 vp9_build_inter_predictors_sbuv(xd, mi_row, mi_col, MAX(bsize, BLOCK_8X8)); | 4184 vp9_build_inter_predictors_sbuv(xd, mi_row, mi_col, |
| 4185 VPXMAX(bsize, BLOCK_8X8)); |
| 4182 | 4186 |
| 4183 vp9_encode_sb(x, MAX(bsize, BLOCK_8X8)); | 4187 vp9_encode_sb(x, VPXMAX(bsize, BLOCK_8X8)); |
| 4184 vp9_tokenize_sb(cpi, td, t, !output_enabled, MAX(bsize, BLOCK_8X8)); | 4188 vp9_tokenize_sb(cpi, td, t, !output_enabled, VPXMAX(bsize, BLOCK_8X8)); |
| 4185 } | 4189 } |
| 4186 | 4190 |
| 4187 if (output_enabled) { | 4191 if (output_enabled) { |
| 4188 if (cm->tx_mode == TX_MODE_SELECT && | 4192 if (cm->tx_mode == TX_MODE_SELECT && |
| 4189 mbmi->sb_type >= BLOCK_8X8 && | 4193 mbmi->sb_type >= BLOCK_8X8 && |
| 4190 !(is_inter_block(mbmi) && (mbmi->skip || seg_skip))) { | 4194 !(is_inter_block(mbmi) && (mbmi->skip || seg_skip))) { |
| 4191 ++get_tx_counts(max_txsize_lookup[bsize], get_tx_size_context(xd), | 4195 ++get_tx_counts(max_txsize_lookup[bsize], get_tx_size_context(xd), |
| 4192 &td->counts->tx)[mbmi->tx_size]; | 4196 &td->counts->tx)[mbmi->tx_size]; |
| 4193 } else { | 4197 } else { |
| 4194 int x, y; | 4198 int x, y; |
| 4195 TX_SIZE tx_size; | 4199 TX_SIZE tx_size; |
| 4196 // The new intra coding scheme requires no change of transform size | 4200 // The new intra coding scheme requires no change of transform size |
| 4197 if (is_inter_block(&mi->mbmi)) { | 4201 if (is_inter_block(&mi->mbmi)) { |
| 4198 tx_size = MIN(tx_mode_to_biggest_tx_size[cm->tx_mode], | 4202 tx_size = VPXMIN(tx_mode_to_biggest_tx_size[cm->tx_mode], |
| 4199 max_txsize_lookup[bsize]); | 4203 max_txsize_lookup[bsize]); |
| 4200 } else { | 4204 } else { |
| 4201 tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4; | 4205 tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4; |
| 4202 } | 4206 } |
| 4203 | 4207 |
| 4204 for (y = 0; y < mi_height; y++) | 4208 for (y = 0; y < mi_height; y++) |
| 4205 for (x = 0; x < mi_width; x++) | 4209 for (x = 0; x < mi_width; x++) |
| 4206 if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) | 4210 if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) |
| 4207 mi_8x8[mis * y + x]->mbmi.tx_size = tx_size; | 4211 mi_8x8[mis * y + x]->mbmi.tx_size = tx_size; |
| 4208 } | 4212 } |
| 4209 ++td->counts->tx.tx_totals[mbmi->tx_size]; | 4213 ++td->counts->tx.tx_totals[mbmi->tx_size]; |
| 4210 ++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])]; | 4214 ++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])]; |
| 4211 } | 4215 } |
| 4212 } | 4216 } |
| OLD | NEW |