Commit c2daa0f13c for aom
commit c2daa0f13c4b236576e3ef48dc625cb836653704
Author: Wan-Teh Chang <wtc@google.com>
Date: Thu Mar 5 18:27:52 2026 -0800
Use enc_row_mt->allocated_tile_cols/rows correctly
enc_row_mt->allocated_tile_cols and enc_row_mt->allocated_tile_rows
should reflect the number of elements in the cpi->tile_data array whose
row_mt_sync field has been allocated by row_mt_mem_alloc().
Do not modify enc_row_mt->allocated_tile_cols and
enc_row_mt->allocated_tile_rows in av1_alloc_tile_data(). Instead,
modify them in row_mt_mem_alloc() and av1_row_mt_mem_dealloc().
Bug: 487259772
Change-Id: Id2db863a6cdeac6bbb93a45f7bf87a5226eb8dde
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ece4d95809..6cc6770967 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1365,7 +1365,6 @@ static inline void init_encode_frame_mb_context(AV1_COMP *cpi) {
void av1_alloc_tile_data(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
- AV1EncRowMultiThreadInfo *const enc_row_mt = &cpi->mt_info.enc_row_mt;
const int tile_cols = cm->tiles.cols;
const int tile_rows = cm->tiles.rows;
@@ -1373,16 +1372,12 @@ void av1_alloc_tile_data(AV1_COMP *cpi) {
aom_free(cpi->tile_data);
cpi->allocated_tiles = 0;
- enc_row_mt->allocated_tile_cols = 0;
- enc_row_mt->allocated_tile_rows = 0;
CHECK_MEM_ERROR(
cm, cpi->tile_data,
aom_memalign(32, tile_cols * tile_rows * sizeof(*cpi->tile_data)));
cpi->allocated_tiles = tile_cols * tile_rows;
- enc_row_mt->allocated_tile_cols = tile_cols;
- enc_row_mt->allocated_tile_rows = tile_rows;
for (int tile_row = 0; tile_row < tile_rows; ++tile_row) {
for (int tile_col = 0; tile_col < tile_cols; ++tile_col) {
const int tile_index = tile_row * tile_cols + tile_col;
diff --git a/av1/encoder/encoder_alloc.h b/av1/encoder/encoder_alloc.h
index 33caa2ac9d..97b5273a95 100644
--- a/av1/encoder/encoder_alloc.h
+++ b/av1/encoder/encoder_alloc.h
@@ -185,15 +185,12 @@ static inline void release_compound_type_rd_buffers(
static inline void dealloc_compressor_data(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
TokenInfo *token_info = &cpi->token_info;
- AV1EncRowMultiThreadInfo *const enc_row_mt = &cpi->mt_info.enc_row_mt;
const int num_planes = av1_num_planes(cm);
dealloc_context_buffers_ext(&cpi->mbmi_ext_info);
aom_free(cpi->tile_data);
cpi->tile_data = NULL;
cpi->allocated_tiles = 0;
- enc_row_mt->allocated_tile_cols = 0;
- enc_row_mt->allocated_tile_rows = 0;
// Delete sementation map
aom_free(cpi->enc_seg.map);
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index c10c662817..1c8d1bdffc 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -265,6 +265,8 @@ static void row_mt_mem_alloc(AV1_COMP *cpi, int max_rows, int max_cols,
}
}
}
+ enc_row_mt->allocated_tile_cols = tile_cols;
+ enc_row_mt->allocated_tile_rows = tile_rows;
const int sb_rows = get_sb_rows_in_frame(cm);
CHECK_MEM_ERROR(
cm, enc_row_mt->num_tile_cols_done,
@@ -295,6 +297,8 @@ void av1_row_mt_mem_dealloc(AV1_COMP *cpi) {
}
}
}
+ enc_row_mt->allocated_tile_cols = 0;
+ enc_row_mt->allocated_tile_rows = 0;
aom_free(enc_row_mt->num_tile_cols_done);
enc_row_mt->num_tile_cols_done = NULL;
enc_row_mt->allocated_rows = 0;