| 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 <math.h> | 11 #include <math.h> |
| 12 | 12 |
| 13 #include "vp9/common/vp9_common.h" | 13 #include "vp9/common/vp9_common.h" |
| 14 #include "vp9/common/vp9_entropymode.h" | 14 #include "vp9/common/vp9_entropymode.h" |
| 15 #include "vp9/common/vp9_systemdependent.h" | |
| 16 | 15 |
| 17 #include "vp9/encoder/vp9_cost.h" | 16 #include "vp9/encoder/vp9_cost.h" |
| 18 #include "vp9/encoder/vp9_encodemv.h" | 17 #include "vp9/encoder/vp9_encodemv.h" |
| 19 | 18 |
| 20 static struct vp9_token mv_joint_encodings[MV_JOINTS]; | 19 static struct vp9_token mv_joint_encodings[MV_JOINTS]; |
| 21 static struct vp9_token mv_class_encodings[MV_CLASSES]; | 20 static struct vp9_token mv_class_encodings[MV_CLASSES]; |
| 22 static struct vp9_token mv_fp_encodings[MV_FP_SIZE]; | 21 static struct vp9_token mv_fp_encodings[MV_FP_SIZE]; |
| 23 static struct vp9_token mv_class0_encodings[CLASS0_SIZE]; | 22 static struct vp9_token mv_class0_encodings[CLASS0_SIZE]; |
| 24 | 23 |
| 25 void vp9_entropy_mv_init(void) { | 24 void vp9_entropy_mv_init(void) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 vp9_write_token(w, vp9_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]); | 209 vp9_write_token(w, vp9_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]); |
| 211 if (mv_joint_vertical(j)) | 210 if (mv_joint_vertical(j)) |
| 212 encode_mv_component(w, diff.row, &mvctx->comps[0], usehp); | 211 encode_mv_component(w, diff.row, &mvctx->comps[0], usehp); |
| 213 | 212 |
| 214 if (mv_joint_horizontal(j)) | 213 if (mv_joint_horizontal(j)) |
| 215 encode_mv_component(w, diff.col, &mvctx->comps[1], usehp); | 214 encode_mv_component(w, diff.col, &mvctx->comps[1], usehp); |
| 216 | 215 |
| 217 // If auto_mv_step_size is enabled then keep track of the largest | 216 // If auto_mv_step_size is enabled then keep track of the largest |
| 218 // motion vector component used. | 217 // motion vector component used. |
| 219 if (cpi->sf.mv.auto_mv_step_size) { | 218 if (cpi->sf.mv.auto_mv_step_size) { |
| 220 unsigned int maxv = MAX(abs(mv->row), abs(mv->col)) >> 3; | 219 unsigned int maxv = VPXMAX(abs(mv->row), abs(mv->col)) >> 3; |
| 221 cpi->max_mv_magnitude = MAX(maxv, cpi->max_mv_magnitude); | 220 cpi->max_mv_magnitude = VPXMAX(maxv, cpi->max_mv_magnitude); |
| 222 } | 221 } |
| 223 } | 222 } |
| 224 | 223 |
| 225 void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2], | 224 void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2], |
| 226 const nmv_context* ctx, int usehp) { | 225 const nmv_context* ctx, int usehp) { |
| 227 vp9_cost_tokens(mvjoint, ctx->joints, vp9_mv_joint_tree); | 226 vp9_cost_tokens(mvjoint, ctx->joints, vp9_mv_joint_tree); |
| 228 build_nmv_component_cost_table(mvcost[0], &ctx->comps[0], usehp); | 227 build_nmv_component_cost_table(mvcost[0], &ctx->comps[0], usehp); |
| 229 build_nmv_component_cost_table(mvcost[1], &ctx->comps[1], usehp); | 228 build_nmv_component_cost_table(mvcost[1], &ctx->comps[1], usehp); |
| 230 } | 229 } |
| 231 | 230 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 259 if (mi->bmi[i].as_mode == NEWMV) | 258 if (mi->bmi[i].as_mode == NEWMV) |
| 260 inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, &td->counts->mv); | 259 inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, &td->counts->mv); |
| 261 } | 260 } |
| 262 } | 261 } |
| 263 } else { | 262 } else { |
| 264 if (mbmi->mode == NEWMV) | 263 if (mbmi->mode == NEWMV) |
| 265 inc_mvs(mbmi, mbmi_ext, mbmi->mv, &td->counts->mv); | 264 inc_mvs(mbmi, mbmi_ext, mbmi->mv, &td->counts->mv); |
| 266 } | 265 } |
| 267 } | 266 } |
| 268 | 267 |
| OLD | NEW |