Commit 550eb17ba5 for aom
commit 550eb17ba54a69175b4f05c8207004aabfbe3fc8
Author: Frank Galligan <fgalligan@google.com>
Date: Thu Nov 26 09:53:42 2026 -0800
Fix -Wunsequenced-volatile warnings for Clang 24
Chrome Clang 24 flags unsequenced accesses to volatile-qualified
pointers (such as cm and cpi in setjmp-guarded functions) within the
same full expression or function argument list.
Hoist repeated reads and nested evaluations (&cpi->rc, cm->prev_frame,
cpi->ppi->twopass.stats_buf_ctx, av1_num_planes(cm),
cm->seq_params->bit_depth, and cpi->oxcf.algo_cfg.sharpness) into local
temporaries in av1_decoder_create, av1_receive_compressed_data, and
av1_create_compressor.
Verified 0 warnings with Chrome Clang 24 (clang-llvmorg-24-init-22088)
in complete, chrome, and encoder-only (-Werror) build configs.
Bug: 590837967
TAG=agy
CONV=f57e68e5-f406-4d82-a08f-9a737c3ba2b5
Change-Id: Ie044b8395e3fefb55fa2bfe2632b69d676eb48e5
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index 81a88b403e..91a356a838 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -135,7 +135,8 @@ AV1Decoder *av1_decoder_create(BufferPool *const pool) {
av1_loop_filter_init(cm);
- av1_qm_init(&cm->quant_params, av1_num_planes(cm));
+ const int num_planes = av1_num_planes(cm);
+ av1_qm_init(&cm->quant_params, num_planes);
av1_loop_restoration_precal();
#if CONFIG_ACCOUNTING
@@ -510,10 +511,10 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
if (!cm->show_existing_frame) {
if (cm->seg.enabled) {
- if (cm->prev_frame &&
- (cm->mi_params.mi_rows == cm->prev_frame->mi_rows) &&
- (cm->mi_params.mi_cols == cm->prev_frame->mi_cols)) {
- cm->last_frame_seg_map = cm->prev_frame->seg_map;
+ const RefCntBuffer *const prev_frame = cm->prev_frame;
+ if (prev_frame && (cm->mi_params.mi_rows == prev_frame->mi_rows) &&
+ (cm->mi_params.mi_cols == prev_frame->mi_cols)) {
+ cm->last_frame_seg_map = prev_frame->seg_map;
} else {
cm->last_frame_seg_map = NULL;
}
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 8cb756de20..eab7b4d69d 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -1588,7 +1588,8 @@ AV1_COMP *av1_create_compressor(AV1_PRIMARY *ppi, const AV1EncoderConfig *oxcf,
cpi->oxcf.gf_cfg.lag_in_frames = lap_lag_in_frames;
}
- av1_rc_init(&cpi->oxcf, &cpi->rc);
+ RATE_CONTROL *const rc = &cpi->rc;
+ av1_rc_init(&cpi->oxcf, rc);
init_frame_info(&cpi->frame_info, cm);
init_frame_index_set(&cpi->frame_index_set);
@@ -1626,12 +1627,10 @@ AV1_COMP *av1_create_compressor(AV1_PRIMARY *ppi, const AV1EncoderConfig *oxcf,
if (!cpi->ppi->lap_enabled) {
/*Re-initialize to stats buffer, populated by application in the case of
* two pass*/
- cpi->ppi->twopass.stats_buf_ctx->stats_in_start =
- oxcf->twopass_stats_in.buf;
- cpi->twopass_frame.stats_in =
- cpi->ppi->twopass.stats_buf_ctx->stats_in_start;
- cpi->ppi->twopass.stats_buf_ctx->stats_in_end =
- &cpi->ppi->twopass.stats_buf_ctx->stats_in_start[packets - 1];
+ STATS_BUFFER_CTX *const stats_buf_ctx = cpi->ppi->twopass.stats_buf_ctx;
+ stats_buf_ctx->stats_in_start = oxcf->twopass_stats_in.buf;
+ cpi->twopass_frame.stats_in = stats_buf_ctx->stats_in_start;
+ stats_buf_ctx->stats_in_end = &stats_buf_ctx->stats_in_start[packets - 1];
// The buffer size is packets - 1 because the last packet is total_stats.
av1_firstpass_info_init(&cpi->ppi->twopass.firstpass_info,
@@ -1724,9 +1723,12 @@ AV1_COMP *av1_create_compressor(AV1_PRIMARY *ppi, const AV1EncoderConfig *oxcf,
prev_deltaq_params->u_ac_delta_q = INT_MAX;
prev_deltaq_params->v_ac_delta_q = INT_MAX;
+ const aom_bit_depth_t bit_depth = cm->seq_params->bit_depth;
+ const int sharpness = cpi->oxcf.algo_cfg.sharpness;
av1_init_quantizer(&cpi->enc_quant_dequant_params, &cm->quant_params,
- cm->seq_params->bit_depth, cpi->oxcf.algo_cfg.sharpness);
- av1_qm_init(&cm->quant_params, av1_num_planes(cm));
+ bit_depth, sharpness);
+ const int num_planes = av1_num_planes(cm);
+ av1_qm_init(&cm->quant_params, num_planes);
av1_loop_filter_init(cm);
cm->superres_scale_denominator = SCALE_NUMERATOR;