Declare some pointer parameters as const Make it clear the functions won't modify the input parameters. This helps code analysis. Also move a break statement in both "if" and "else" blocks outside the if-else statement. Change-Id: Id08a6f212d0c4c8e41eb85faa8de5ddcb744a2ae
diff --git a/av1/common/tile_common.c b/av1/common/tile_common.c index 508fe30..b964f25 100644 --- a/av1/common/tile_common.c +++ b/av1/common/tile_common.c
@@ -167,12 +167,12 @@ assert(tile->mi_col_end > tile->mi_col_start); } -int av1_get_sb_rows_in_tile(AV1_COMMON *cm, const TileInfo *tile) { +int av1_get_sb_rows_in_tile(const AV1_COMMON *cm, const TileInfo *tile) { return CEIL_POWER_OF_TWO(tile->mi_row_end - tile->mi_row_start, cm->seq_params->mib_size_log2); } -int av1_get_sb_cols_in_tile(AV1_COMMON *cm, const TileInfo *tile) { +int av1_get_sb_cols_in_tile(const AV1_COMMON *cm, const TileInfo *tile) { return CEIL_POWER_OF_TWO(tile->mi_col_end - tile->mi_col_start, cm->seq_params->mib_size_log2); }
diff --git a/av1/common/tile_common.h b/av1/common/tile_common.h index 8615a2c..5383ae9 100644 --- a/av1/common/tile_common.h +++ b/av1/common/tile_common.h
@@ -40,8 +40,8 @@ void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row); void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col); -int av1_get_sb_rows_in_tile(struct AV1Common *cm, const TileInfo *tile); -int av1_get_sb_cols_in_tile(struct AV1Common *cm, const TileInfo *tile); +int av1_get_sb_rows_in_tile(const struct AV1Common *cm, const TileInfo *tile); +int av1_get_sb_cols_in_tile(const struct AV1Common *cm, const TileInfo *tile); // Return the pixel extents of the given tile PixelRect av1_get_tile_rect(const TileInfo *tile_info,
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c index 6f3cbd7..3a9fa84 100644 --- a/av1/encoder/ethread.c +++ b/av1/encoder/ethread.c
@@ -1626,7 +1626,7 @@ #endif // Computes the number of workers for row multi-threading of encoding stage -static AOM_INLINE int compute_num_enc_row_mt_workers(AV1_COMMON *const cm, +static AOM_INLINE int compute_num_enc_row_mt_workers(const AV1_COMMON *cm, int max_threads) { TileInfo tile_info; const int tile_cols = cm->tiles.cols; @@ -1645,7 +1645,7 @@ } // Computes the number of workers for tile multi-threading of encoding stage -static AOM_INLINE int compute_num_enc_tile_mt_workers(AV1_COMMON *const cm, +static AOM_INLINE int compute_num_enc_tile_mt_workers(const AV1_COMMON *cm, int max_threads) { const int tile_cols = cm->tiles.cols; const int tile_rows = cm->tiles.rows; @@ -1663,7 +1663,7 @@ } // Computes the number of workers for encoding stage (row/tile multi-threading) -int av1_compute_num_enc_workers(AV1_COMP *cpi, int max_workers) { +int av1_compute_num_enc_workers(const AV1_COMP *cpi, int max_workers) { if (max_workers <= 1) return 1; if (cpi->oxcf.row_mt) return compute_num_enc_row_mt_workers(&cpi->common, max_workers); @@ -3218,7 +3218,7 @@ } // Computes num_workers for temporal filter multi-threading. -static AOM_INLINE int compute_num_tf_workers(AV1_COMP *cpi) { +static AOM_INLINE int compute_num_tf_workers(const AV1_COMP *cpi) { // For single-pass encode, using no. of workers as per tf block size was not // found to improve speed. Hence the thread assignment for single-pass encode // is kept based on compute_num_enc_workers(). @@ -3303,11 +3303,10 @@ case MOD_AI: if (cpi->oxcf.pass == AOM_RC_ONE_PASS) { num_mod_workers = compute_num_ai_workers(cpi); - break; } else { num_mod_workers = 0; - break; } + break; default: assert(0); break; } return (num_mod_workers);
diff --git a/av1/encoder/ethread.h b/av1/encoder/ethread.h index 97edb64..fc9150c 100644 --- a/av1/encoder/ethread.h +++ b/av1/encoder/ethread.h
@@ -114,7 +114,7 @@ unsigned int *max_tile_size, uint32_t *const obu_header_size, uint8_t **tile_data_start, const int num_workers); -int av1_compute_num_enc_workers(AV1_COMP *cpi, int max_workers); +int av1_compute_num_enc_workers(const AV1_COMP *cpi, int max_workers); int av1_compute_num_fp_contexts(AV1_PRIMARY *ppi, AV1EncoderConfig *oxcf);