Fix width/height confusion in av1_first_pass_row() Change-Id: Ie30c68e5a22164a92f60a8acb7b4cb0721c34a83
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index 1e75ce3..e8c15cb 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c
@@ -1146,8 +1146,8 @@ MACROBLOCKD *const xd = &x->e_mbd; TileInfo *tile = &tile_data->tile_info; const int qindex = find_fp_qindex(seq_params->bit_depth); - const int fp_block_size_width = block_size_high[fp_block_size]; - const int fp_block_size_height = block_size_wide[fp_block_size]; + const int fp_block_size_width = block_size_wide[fp_block_size]; + const int fp_block_size_height = block_size_high[fp_block_size]; const int unit_width = mi_size_wide[fp_block_size]; const int unit_width_log2 = mi_size_wide_log2[fp_block_size]; const int unit_height_log2 = mi_size_high_log2[fp_block_size]; @@ -1194,6 +1194,8 @@ const int src_y_stride = cpi->source->y_stride; const int recon_y_stride = this_frame->y_stride; const int recon_uv_stride = this_frame->uv_stride; + const int uv_mb_width = + fp_block_size_width >> (this_frame->y_width > this_frame->uv_width); const int uv_mb_height = fp_block_size_height >> (this_frame->y_height > this_frame->uv_height); @@ -1207,7 +1209,7 @@ int src_yoffset = (unit_row * src_y_stride * fp_block_size_height) + (unit_col_start * fp_block_size_width); int recon_uvoffset = (unit_row * recon_uv_stride * uv_mb_height) + - (unit_col_start * uv_mb_height); + (unit_col_start * uv_mb_width); // Set up limit values for motion vectors to prevent them extending // outside the UMV borders. @@ -1265,13 +1267,13 @@ // Adjust to the next column of MBs. x->plane[0].src.buf += fp_block_size_width; if (num_planes > 1) { - x->plane[1].src.buf += uv_mb_height; - x->plane[2].src.buf += uv_mb_height; + x->plane[1].src.buf += uv_mb_width; + x->plane[2].src.buf += uv_mb_width; } recon_yoffset += fp_block_size_width; src_yoffset += fp_block_size_width; - recon_uvoffset += uv_mb_height; + recon_uvoffset += uv_mb_width; mb_stats++; enc_row_mt->sync_write_ptr(row_mt_sync, unit_row_in_tile, unit_col_in_tile,