Fix rows/cols vs. width/height confusion in params Also add /*rows=*/ and /*cols=*/ parameter comments to help disambiguate. Perhaps it would be better to change the rows and cols parameters to width and height, but I didn't attempt that. Change-Id: I40cc666f6c5c7dbde20a31306987d4ba9caecd09
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index e3138b5..b4d4277 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -2052,12 +2052,14 @@ int count_buf[1 << 8]; // Maximum (1 << 8) bins for hbd path. const uint8_t *const this_src = src + r * stride + c; int n_colors; - if (use_hbd) - av1_count_colors_highbd(this_src, stride, kBlockWidth, kBlockHeight, bd, - NULL, count_buf, &n_colors, NULL); - else - av1_count_colors(this_src, stride, kBlockWidth, kBlockHeight, count_buf, - &n_colors); + if (use_hbd) { + av1_count_colors_highbd(this_src, stride, /*rows=*/kBlockHeight, + /*cols=*/kBlockWidth, bd, NULL, count_buf, + &n_colors, NULL); + } else { + av1_count_colors(this_src, stride, /*rows=*/kBlockHeight, + /*cols=*/kBlockWidth, count_buf, &n_colors); + } if (n_colors > 1 && n_colors <= kColorThresh) { ++counts_1; struct buf_2d buf; @@ -2295,8 +2297,8 @@ // First, find if the block could be palettized int number_of_colors; - av1_count_colors(blk, blk_stride, kBlockWidth, kBlockHeight, count_buf, - &number_of_colors); + av1_count_colors(blk, blk_stride, /*rows=*/kBlockHeight, + /*cols=*/kBlockWidth, count_buf, &number_of_colors); if (number_of_colors > 1 && number_of_colors <= kComplexInitialColorThresh) { @@ -2325,9 +2327,9 @@ // Dilate block with dominant color, to exclude anti-aliased pixels // from final palette count av1_dilate_block(blk, blk_stride, dilated_blk, kBlockWidth, - kBlockWidth, kBlockHeight); - av1_count_colors(dilated_blk, kBlockWidth, kBlockWidth, kBlockHeight, - count_buf, &number_of_colors); + /*rows=*/kBlockHeight, /*cols=*/kBlockWidth); + av1_count_colors(dilated_blk, kBlockWidth, /*rows=*/kBlockHeight, + /*cols=*/kBlockWidth, count_buf, &number_of_colors); if (number_of_colors <= kComplexFinalColorThresh) { ++count_palette;
diff --git a/test/screen_content_detection_mode_2_test.cc b/test/screen_content_detection_mode_2_test.cc index cc9f747..5d9697c 100644 --- a/test/screen_content_detection_mode_2_test.cc +++ b/test/screen_content_detection_mode_2_test.cc
@@ -37,13 +37,16 @@ TEST(ScreenContentDetectionMode2, FindDominantValue) { // Find the dominant value of kSource[], which should be 255, // as it appears 22 times. This is in contrast to 0 (16 times). - EXPECT_EQ(av1_find_dominant_value(kSource, kWidth, kHeight, kWidth), 255); + EXPECT_EQ(av1_find_dominant_value(kSource, kWidth, /*rows=*/kHeight, + /*cols=*/kWidth), + 255); } TEST(ScreenContentDetectionMode2, DilateBlock) { uint8_t dilated[kWidth * kHeight] = { 0 }; - av1_dilate_block(kSource, kWidth, dilated, kWidth, kHeight, kWidth); + av1_dilate_block(kSource, kWidth, dilated, kWidth, /*rows=*/kHeight, + /*cols=*/kWidth); // Compare values coming from av1_dilate_block() against the expected values for (int r = 0; r < kHeight; ++r) {