From 74114a3a1e697e23119a70fe4b7b401e5357b6be Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Thu, 13 Oct 2016 17:11:08 -0700 Subject: [PATCH] Bugfix: fix the build for CONFIG_FP_MB_STATS Cherry-picked from aomedia/master: bf6c636 Change-Id: Iea3fb46d23cb94d1152de3a7a40b6a183e78b4d7 --- av1/encoder/firstpass.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index 9fdf54053..396f0d7f2 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c @@ -126,12 +126,12 @@ static void output_stats(FIRSTPASS_STATS *stats, } #if CONFIG_FP_MB_STATS -static void output_fpmb_stats(uint8_t *this_frame_mb_stats, AV1_COMMON *cm, +static void output_fpmb_stats(uint8_t *this_frame_mb_stats, int stats_size, struct aom_codec_pkt_list *pktlist) { struct aom_codec_cx_pkt pkt; pkt.kind = AOM_CODEC_FPMB_STATS_PKT; pkt.data.firstpass_mb_stats.buf = this_frame_mb_stats; - pkt.data.firstpass_mb_stats.sz = cm->initial_mbs * sizeof(uint8_t); + pkt.data.firstpass_mb_stats.sz = stats_size * sizeof(*this_frame_mb_stats); aom_codec_pkt_list_add(pktlist, &pkt); } #endif @@ -500,7 +500,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) { #if CONFIG_FP_MB_STATS if (cpi->use_fp_mb_stats) { - av1_zero_array(cpi->twopass.frame_mb_stats_buf, cm->initial_mbs); + av1_zero_array(cpi->twopass.frame_mb_stats_buf, cpi->initial_mbs); } #endif @@ -846,17 +846,15 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) { cpi->twopass.frame_mb_stats_buf[mb_index] &= ~FPMB_MOTION_ZERO_MASK; // check estimated motion direction - if (mv.as_mv.col > 0 && mv.as_mv.col >= abs(mv.as_mv.row)) { + if (mv.col > 0 && mv.col >= abs(mv.row)) { // right direction cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_MOTION_RIGHT_MASK; - } else if (mv.as_mv.row < 0 && - abs(mv.as_mv.row) >= abs(mv.as_mv.col)) { + } else if (mv.row < 0 && abs(mv.row) >= abs(mv.col)) { // up direction cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_MOTION_UP_MASK; - } else if (mv.as_mv.col < 0 && - abs(mv.as_mv.col) >= abs(mv.as_mv.row)) { + } else if (mv.col < 0 && abs(mv.col) >= abs(mv.row)) { // left direction cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_MOTION_LEFT_MASK; @@ -999,7 +997,8 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) { #if CONFIG_FP_MB_STATS if (cpi->use_fp_mb_stats) { - output_fpmb_stats(twopass->frame_mb_stats_buf, cm, cpi->output_pkt_list); + output_fpmb_stats(twopass->frame_mb_stats_buf, cpi->initial_mbs, + cpi->output_pkt_list); } #endif }