diff options
-rw-r--r-- | vp9/common/vp9_loopfilter.c | 24 | ||||
-rw-r--r-- | vp9/common/vp9_mvref_common.c | 99 | ||||
-rw-r--r-- | vp9/common/vp9_quant_common.c | 59 | ||||
-rw-r--r-- | vp9/common/vp9_quant_common.h | 15 | ||||
-rw-r--r-- | vp9/common/vp9_tile_common.c | 4 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodemv.c | 68 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodframe.c | 2 |
7 files changed, 89 insertions, 182 deletions
diff --git a/vp9/common/vp9_loopfilter.c b/vp9/common/vp9_loopfilter.c index d23f6f596..cbdb273b0 100644 --- a/vp9/common/vp9_loopfilter.c +++ b/vp9/common/vp9_loopfilter.c @@ -129,7 +129,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm, lvl_seg = vp9_get_segdata(xd, seg, SEG_LVL_ALT_LF); } else { /* Delta Value */ lvl_seg += vp9_get_segdata(xd, seg, SEG_LVL_ALT_LF); - lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63 : lvl_seg) : 0; + lvl_seg = clamp(lvl_seg, 0, 63); } } @@ -152,13 +152,12 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm, /* Apply delta for Intra modes */ mode = 0; /* B_PRED */ /* Only the split mode BPRED has a further special case */ - lvl_mode = lvl_ref + xd->mode_lf_deltas[mode]; - lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */ + lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63); lfi->lvl[seg][ref][mode] = lvl_mode; mode = 1; /* all the rest of Intra modes */ - lvl_mode = (lvl_ref > 0) ? (lvl_ref > 63 ? 63 : lvl_ref) : 0; /* clamp */ + lvl_mode = clamp(lvl_ref, 0, 63); lfi->lvl[seg][ref][mode] = lvl_mode; /* LAST, GOLDEN, ALT */ @@ -170,9 +169,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm, /* Apply delta for Inter modes */ for (mode = 1; mode < 4; mode++) { - lvl_mode = lvl_ref + xd->mode_lf_deltas[mode]; - lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */ - + lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63); lfi->lvl[seg][ref][mode] = lvl_mode; } } @@ -436,16 +433,13 @@ void vp9_loop_filter_partial_frame(VP9_COMMON *cm, MACROBLOCKD *xd, */ if (alt_flt_enabled) { for (i = 0; i < MAX_MB_SEGMENTS; i++) { - /* Abs value */ if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) { + // Abs value lvl_seg[i] = vp9_get_segdata(xd, i, SEG_LVL_ALT_LF); - } - /* Delta Value */ - else { - lvl_seg[i] = default_filt_lvl + - vp9_get_segdata(xd, i, SEG_LVL_ALT_LF); - lvl_seg[i] = (lvl_seg[i] > 0) ? - ((lvl_seg[i] > 63) ? 63 : lvl_seg[i]) : 0; + } else { + // Delta Value + lvl_seg[i] = default_filt_lvl + vp9_get_segdata(xd, i, SEG_LVL_ALT_LF); + lvl_seg[i] = clamp(lvl_seg[i], 0, 63); } } } diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c index 2f322a33f..d23530a2e 100644 --- a/vp9/common/vp9_mvref_common.c +++ b/vp9/common/vp9_mvref_common.c @@ -32,45 +32,36 @@ static int sb_ref_distance_weight[MVREF_NEIGHBOURS] = #define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units static void clamp_mv_ref(const MACROBLOCKD *xd, int_mv *mv) { - if (mv->as_mv.col < (xd->mb_to_left_edge - MV_BORDER)) - mv->as_mv.col = xd->mb_to_left_edge - MV_BORDER; - else if (mv->as_mv.col > xd->mb_to_right_edge + MV_BORDER) - mv->as_mv.col = xd->mb_to_right_edge + MV_BORDER; - - if (mv->as_mv.row < (xd->mb_to_top_edge - MV_BORDER)) - mv->as_mv.row = xd->mb_to_top_edge - MV_BORDER; - else if (mv->as_mv.row > xd->mb_to_bottom_edge + MV_BORDER) - mv->as_mv.row = xd->mb_to_bottom_edge + MV_BORDER; + mv->as_mv.col = clamp(mv->as_mv.col, xd->mb_to_left_edge - MV_BORDER, + xd->mb_to_right_edge + MV_BORDER); + mv->as_mv.row = clamp(mv->as_mv.row, xd->mb_to_top_edge - MV_BORDER, + xd->mb_to_bottom_edge + MV_BORDER); } // Gets a candidate refenence motion vector from the given mode info // structure if one exists that matches the given reference frame. static int get_matching_candidate(const MODE_INFO *candidate_mi, - MV_REFERENCE_FRAME ref_frame, - int_mv *c_mv) { - int ret_val = TRUE; - + MV_REFERENCE_FRAME ref_frame, + int_mv *c_mv) { if (ref_frame == candidate_mi->mbmi.ref_frame) { c_mv->as_int = candidate_mi->mbmi.mv[0].as_int; } else if (ref_frame == candidate_mi->mbmi.second_ref_frame) { c_mv->as_int = candidate_mi->mbmi.mv[1].as_int; } else { - ret_val = FALSE; + return 0; } - return ret_val; + return 1; } // Gets candidate refenence motion vector(s) from the given mode info // structure if they exists and do NOT match the given reference frame. -static void get_non_matching_candidates( - const MODE_INFO *candidate_mi, - MV_REFERENCE_FRAME ref_frame, - MV_REFERENCE_FRAME *c_ref_frame, - int_mv *c_mv, - MV_REFERENCE_FRAME *c2_ref_frame, - int_mv *c2_mv -) { +static void get_non_matching_candidates(const MODE_INFO *candidate_mi, + MV_REFERENCE_FRAME ref_frame, + MV_REFERENCE_FRAME *c_ref_frame, + int_mv *c_mv, + MV_REFERENCE_FRAME *c2_ref_frame, + int_mv *c2_mv) { c_mv->as_int = 0; c2_mv->as_int = 0; @@ -88,8 +79,7 @@ static void get_non_matching_candidates( // Second candidate if ((candidate_mi->mbmi.second_ref_frame > INTRA_FRAME) && (candidate_mi->mbmi.second_ref_frame != ref_frame) && - (candidate_mi->mbmi.mv[1].as_int != - candidate_mi->mbmi.mv[0].as_int)) { + (candidate_mi->mbmi.mv[1].as_int != candidate_mi->mbmi.mv[0].as_int)) { *c2_ref_frame = candidate_mi->mbmi.second_ref_frame; c2_mv->as_int = candidate_mi->mbmi.mv[1].as_int; } @@ -98,13 +88,9 @@ static void get_non_matching_candidates( // Performs mv sign inversion if indicated by the reference frame combination. -static void scale_mv( - MACROBLOCKD *xd, - MV_REFERENCE_FRAME this_ref_frame, - MV_REFERENCE_FRAME candidate_ref_frame, - int_mv *candidate_mv, - int *ref_sign_bias -) { +static void scale_mv(MACROBLOCKD *xd, MV_REFERENCE_FRAME this_ref_frame, + MV_REFERENCE_FRAME candidate_ref_frame, + int_mv *candidate_mv, int *ref_sign_bias) { // int frame_distances[MAX_REF_FRAMES]; // int last_distance = 1; // int gf_distance = xd->frames_since_golden; @@ -211,19 +197,13 @@ static void addmv_and_shuffle( // Unlike the addmv_and_shuffle() this does not reorder the list // but assumes that candidates are added in the order most likely to // match distance and reference frame bias. -static void add_candidate_mv( - int_mv *mv_list, - int *mv_scores, - int *candidate_count, - int_mv candidate_mv, - int weight -) { +static void add_candidate_mv(int_mv *mv_list, int *mv_scores, + int *candidate_count, int_mv candidate_mv, + int weight) { int i; - int insert_point; // Make sure we dont insert off the end of the list - insert_point = (*candidate_count < (MAX_MV_REF_CANDIDATES - 1)) - ? *candidate_count : (MAX_MV_REF_CANDIDATES - 1); + const int insert_point = MIN(*candidate_count, MAX_MV_REF_CANDIDATES - 1); // Look for duplicates for (i = 0; i <= insert_point; ++i) { @@ -233,8 +213,7 @@ static void add_candidate_mv( // Add the candidate. If the list is already full it is only desirable that // it should overwrite if it has a higher weight than the last entry. - if ((i >= insert_point) && - (weight > mv_scores[insert_point])) { + if (i >= insert_point && weight > mv_scores[insert_point]) { mv_list[insert_point].as_int = candidate_mv.as_int; mv_scores[insert_point] = weight; *candidate_count += (*candidate_count < MAX_MV_REF_CANDIDATES); @@ -244,16 +223,9 @@ static void add_candidate_mv( // This function searches the neighbourhood of a given MB/SB and populates a // list of candidate reference vectors. // -void vp9_find_mv_refs( - VP9_COMMON *cm, - MACROBLOCKD *xd, - MODE_INFO *here, - MODE_INFO *lf_here, - MV_REFERENCE_FRAME ref_frame, - int_mv *mv_ref_list, - int *ref_sign_bias -) { - +void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, + MODE_INFO *lf_here, MV_REFERENCE_FRAME ref_frame, + int_mv *mv_ref_list, int *ref_sign_bias) { int i; MODE_INFO *candidate_mi; MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi; @@ -397,20 +369,12 @@ void vp9_find_mv_refs( } else { mbmi->mb_mode_context[ref_frame] = 2; } - // Non zero best, No Split MV cases } else if (split_count == 0) { - if (candidate_scores[0] >= 16) { - mbmi->mb_mode_context[ref_frame] = 3; - } else { - mbmi->mb_mode_context[ref_frame] = 4; - } - // Non zero best, some split mv + // Non zero best, No Split MV cases + mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 3 : 4; } else { - if (candidate_scores[0] >= 16) { - mbmi->mb_mode_context[ref_frame] = 5; - } else { - mbmi->mb_mode_context[ref_frame] = 6; - } + // Non zero best, some split mv + mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 5 : 6; } // Scan for 0,0 case and clamp non zero choices @@ -422,9 +386,8 @@ void vp9_find_mv_refs( } } // 0,0 is always a valid reference. Add it if not already seen. - if (!zero_seen) { + if (!zero_seen) candidate_mvs[MAX_MV_REF_CANDIDATES-1].as_int = 0; - } // Copy over the candidate list. vpx_memcpy(mv_ref_list, candidate_mvs, sizeof(candidate_mvs)); diff --git a/vp9/common/vp9_quant_common.c b/vp9/common/vp9_quant_common.c index 90eb88ed3..a94c772be 100644 --- a/vp9/common/vp9_quant_common.c +++ b/vp9/common/vp9_quant_common.c @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ - +#include "vp9/common/vp9_common.h" #include "vp9/common/vp9_quant_common.h" static int dc_qlookup[QINDEX_RANGE]; @@ -24,7 +24,7 @@ void vp9_init_quant_tables() { for (i = 0; i < QINDEX_RANGE; i++) { ac_qlookup[i] = current_val; - current_val = (int)((double)current_val * 1.02); + current_val = (int)(current_val * 1.02); if (current_val == last_val) current_val++; last_val = current_val; @@ -38,57 +38,18 @@ void vp9_init_quant_tables() { } } -int vp9_dc_quant(int QIndex, int Delta) { - int retval; - - QIndex = QIndex + Delta; - - if (QIndex > MAXQ) - QIndex = MAXQ; - else if (QIndex < 0) - QIndex = 0; - - retval = dc_qlookup[ QIndex ]; - return retval; +int vp9_dc_quant(int qindex, int delta) { + return dc_qlookup[clamp(qindex + delta, 0, MAXQ)]; } -int vp9_dc_uv_quant(int QIndex, int Delta) { - int retval; - - QIndex = QIndex + Delta; - - if (QIndex > MAXQ) - QIndex = MAXQ; - else if (QIndex < 0) - QIndex = 0; - - retval = dc_qlookup[ QIndex ]; - - return retval; +int vp9_dc_uv_quant(int qindex, int delta) { + return dc_qlookup[clamp(qindex + delta, 0, MAXQ)]; } -int vp9_ac_yquant(int QIndex) { - int retval; - - if (QIndex > MAXQ) - QIndex = MAXQ; - else if (QIndex < 0) - QIndex = 0; - - retval = ac_qlookup[ QIndex ]; - return retval; +int vp9_ac_yquant(int qindex) { + return ac_qlookup[clamp(qindex, 0, MAXQ)]; } -int vp9_ac_uv_quant(int QIndex, int Delta) { - int retval; - - QIndex = QIndex + Delta; - - if (QIndex > MAXQ) - QIndex = MAXQ; - else if (QIndex < 0) - QIndex = 0; - - retval = ac_qlookup[ QIndex ]; - return retval; +int vp9_ac_uv_quant(int qindex, int delta) { + return ac_qlookup[clamp(qindex + delta, 0, MAXQ)]; } diff --git a/vp9/common/vp9_quant_common.h b/vp9/common/vp9_quant_common.h index 871c2b035..1520c3797 100644 --- a/vp9/common/vp9_quant_common.h +++ b/vp9/common/vp9_quant_common.h @@ -11,16 +11,15 @@ #ifndef VP9_COMMON_VP9_QUANT_COMMON_H_ #define VP9_COMMON_VP9_QUANT_COMMON_H_ -#include "string.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_onyxc_int.h" -extern void vp9_init_quant_tables(void); -extern int vp9_ac_yquant(int QIndex); -extern int vp9_dc_quant(int QIndex, int Delta); -extern int vp9_dc2quant(int QIndex, int Delta); -extern int vp9_ac2quant(int QIndex, int Delta); -extern int vp9_dc_uv_quant(int QIndex, int Delta); -extern int vp9_ac_uv_quant(int QIndex, int Delta); +void vp9_init_quant_tables(); +int vp9_ac_yquant(int qindex); +int vp9_dc_quant(int qindex, int delta); +int vp9_dc2quant(int qindex, int delta); +int vp9_ac2quant(int qindex, int delta); +int vp9_dc_uv_quant(int qindex, int delta); +int vp9_ac_uv_quant(int qindex, int delta); #endif // VP9_COMMON_VP9_QUANT_COMMON_H_ diff --git a/vp9/common/vp9_tile_common.c b/vp9/common/vp9_tile_common.c index 53a1eb8c6..b6178f27d 100644 --- a/vp9/common/vp9_tile_common.c +++ b/vp9/common/vp9_tile_common.c @@ -22,8 +22,8 @@ static void vp9_get_tile_offsets(VP9_COMMON *cm, int *min_tile_off, const int sb_off1 = (tile_idx * n_sbs) >> log2_n_tiles; const int sb_off2 = ((tile_idx + 1) * n_sbs) >> log2_n_tiles; - *min_tile_off = (sb_off1 << 2) > n_mbs ? n_mbs : (sb_off1 << 2); - *max_tile_off = (sb_off2 << 2) > n_mbs ? n_mbs : (sb_off2 << 2); + *min_tile_off = MIN(sb_off1 << 2, n_mbs); + *max_tile_off = MIN(sb_off2 << 2, n_mbs); } void vp9_get_tile_col_offsets(VP9_COMMON *cm, int tile_col_idx) { diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 507a1b5b8..ddfdaba4f 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -76,12 +76,10 @@ static MB_PREDICTION_MODE read_uv_mode(vp9_reader *bc, const vp9_prob *p) { // This function reads the current macro block's segnent id from the bitstream // It should only be called if a segment map update is indicated. static void read_mb_segid(vp9_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *xd) { - /* Is segmentation enabled */ if (xd->segmentation_enabled && xd->update_mb_segmentation_map) { - /* If so then read the segment id. */ - mi->segment_id = vp9_read(r, xd->mb_segment_tree_probs[0]) ? - (unsigned char)(2 + vp9_read(r, xd->mb_segment_tree_probs[2])): - (unsigned char)(vp9_read(r, xd->mb_segment_tree_probs[1])); + const vp9_prob *const p = xd->mb_segment_tree_probs; + mi->segment_id = vp9_read(r, p[0]) ? 2 + vp9_read(r, p[2]) + : vp9_read(r, p[1]); } } @@ -90,21 +88,15 @@ static void read_mb_segid(vp9_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *xd) { static void read_mb_segid_except(VP9_COMMON *cm, vp9_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *xd, int mb_row, int mb_col) { - int pred_seg_id = vp9_get_pred_mb_segid(cm, xd, - mb_row * cm->mb_cols + mb_col); - const vp9_prob *p = xd->mb_segment_tree_probs; - vp9_prob p1 = xd->mb_segment_mispred_tree_probs[pred_seg_id]; + const int mb_index = mb_row * cm->mb_cols + mb_col; + const int pred_seg_id = vp9_get_pred_mb_segid(cm, xd, mb_index); + const vp9_prob *const p = xd->mb_segment_tree_probs; + const vp9_prob prob = xd->mb_segment_mispred_tree_probs[pred_seg_id]; - /* Is segmentation enabled */ if (xd->segmentation_enabled && xd->update_mb_segmentation_map) { - /* If so then read the segment id. */ - if (vp9_read(r, p1)) { - mi->segment_id = 2 + - (pred_seg_id < 2 ? vp9_read(r, p[2]) : (pred_seg_id == 2)); - } else { - mi->segment_id = - pred_seg_id >= 2 ? vp9_read(r, p[1]) : (pred_seg_id == 0); - } + mi->segment_id = vp9_read(r, prob) + ? 2 + (pred_seg_id < 2 ? vp9_read(r, p[2]) : (pred_seg_id == 2)) + : (pred_seg_id >= 2 ? vp9_read(r, p[1]) : (pred_seg_id == 0)); } } @@ -265,8 +257,8 @@ static int read_nmv_component_fp(vp9_reader *r, offset += f << 1; if (usehp) { - offset += mv_class == MV_CLASS_0 ? - vp9_read(r, mvcomp->class0_hp) : vp9_read(r, mvcomp->hp); + const vp9_prob p = mv_class == MV_CLASS_0 ? mvcomp->class0_hp : mvcomp->hp; + offset += vp9_read(r, p); } else { offset += 1; // If hp is not used, the default value of the hp bit is 1 } @@ -567,10 +559,10 @@ static void read_mb_segment_id(VP9D_COMP *pbi, int mb_row, int mb_col, BOOL_DECODER* const bc) { VP9_COMMON *const cm = &pbi->common; - MACROBLOCKD *const xd = &pbi->mb; + MACROBLOCKD *const xd = &pbi->mb; MODE_INFO *mi = xd->mode_info_context; MB_MODE_INFO *mbmi = &mi->mbmi; - int index = mb_row * pbi->common.mb_cols + mb_col; + int mb_index = mb_row * pbi->common.mb_cols + mb_col; if (xd->segmentation_enabled) { if (xd->update_mb_segmentation_map) { @@ -589,7 +581,7 @@ static void read_mb_segment_id(VP9D_COMP *pbi, // If the value is flagged as correctly predicted // then use the predicted value if (seg_pred_flag) { - mbmi->segment_id = vp9_get_pred_mb_segid(cm, xd, index); + mbmi->segment_id = vp9_get_pred_mb_segid(cm, xd, mb_index); } else { // Decode it explicitly read_mb_segid_except(cm, bc, mbmi, xd, mb_row, mb_col); @@ -607,12 +599,12 @@ static void read_mb_segment_id(VP9D_COMP *pbi, for (y = 0; y < ymbs; y++) { for (x = 0; x < xmbs; x++) { - cm->last_frame_seg_map[index + x + y * cm->mb_cols] = + cm->last_frame_seg_map[mb_index + x + y * cm->mb_cols] = mbmi->segment_id; } } } else { - cm->last_frame_seg_map[index] = mbmi->segment_id; + cm->last_frame_seg_map[mb_index] = mbmi->segment_id; } } else { if (mbmi->sb_type) { @@ -625,12 +617,12 @@ static void read_mb_segment_id(VP9D_COMP *pbi, for (y = 0; y < ymbs; y++) { for (x = 0; x < xmbs; x++) { segment_id = MIN(segment_id, - cm->last_frame_seg_map[index + x + y * cm->mb_cols]); + cm->last_frame_seg_map[mb_index + x + y * cm->mb_cols]); } } mbmi->segment_id = segment_id; } else { - mbmi->segment_id = cm->last_frame_seg_map[index]; + mbmi->segment_id = cm->last_frame_seg_map[mb_index]; } } } else { @@ -668,7 +660,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, VP9_COMMON *const cm = &pbi->common; nmv_context *const nmvc = &pbi->common.fc.nmvc; const int mis = pbi->common.mode_info_stride; - MACROBLOCKD *const xd = &pbi->mb; + MACROBLOCKD *const xd = &pbi->mb; int_mv *const mv = &mbmi->mv[0]; const int mb_size = 1 << mi->mbmi.sb_type; @@ -677,10 +669,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, cm->height == cm->last_height && !cm->error_resilient_mode; - int mb_to_left_edge; - int mb_to_right_edge; - int mb_to_top_edge = xd->mb_to_top_edge - LEFT_TOP_MARGIN; - int mb_to_bottom_edge = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN; + int mb_to_left_edge, mb_to_right_edge, mb_to_top_edge, mb_to_bottom_edge; mbmi->need_to_clamp_mvs = 0; mbmi->need_to_clamp_secondmv = 0; @@ -697,6 +686,8 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, set_mb_row(cm, xd, mb_row, mb_size); set_mb_col(cm, xd, mb_col, mb_size); + mb_to_top_edge = xd->mb_to_top_edge - LEFT_TOP_MARGIN; + mb_to_bottom_edge = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN; mb_to_left_edge = xd->mb_to_left_edge - LEFT_TOP_MARGIN; mb_to_right_edge = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN; @@ -898,13 +889,13 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, mbmi->uv_mode = DC_PRED; switch (mbmi->mode) { case SPLITMV: { - const int s = mbmi->partitioning = - treed_read(bc, vp9_mbsplit_tree, cm->fc.mbsplit_prob); - const int num_p = vp9_mbsplit_count [s]; + const int s = treed_read(bc, vp9_mbsplit_tree, cm->fc.mbsplit_prob); + const int num_p = vp9_mbsplit_count[s]; int j = 0; - cm->fc.mbsplit_counts[s]++; + cm->fc.mbsplit_counts[s]++; mbmi->need_to_clamp_mvs = 0; + mbmi->partitioning = s; do { // for each subset j int_mv leftmv, abovemv, second_leftmv, second_abovemv; int_mv blockmv, secondmv; @@ -1084,9 +1075,8 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, if (mbmi->mode == B_PRED) { int j = 0; do { - int m; - m = mi->bmi[j].as_mode.first = read_bmode(bc, - pbi->common.fc.bmode_prob); + int m = read_bmode(bc, pbi->common.fc.bmode_prob); + mi->bmi[j].as_mode.first = m; #if CONFIG_NEWBINTRAMODES if (m == B_CONTEXT_PRED) m -= CONTEXT_PRED_REPLACEMENTS; #endif diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index cb6421f63..0e409f727 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -1291,7 +1291,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) { pc->version = (data[0] >> 1) & 7; pc->show_frame = (data[0] >> 4) & 1; scaling_active = (data[0] >> 5) & 1; - first_partition_length_in_bytes = data[1] | (data[2] << 8); + first_partition_length_in_bytes = read_le16(data + 1); if (!read_is_valid(data, first_partition_length_in_bytes, data_end)) vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME, |