Bug Summary

File:root/firefox-clang/media/libvpx/libvpx/vp8/common/onyxc_int.h
Warning:line 62, column 16
Excessive padding in 'struct VP8Common' (37 padding bytes, where 5 is optimal). Optimal fields order: Y1dequant, Y2dequant, UVdequant, lf_info, frame_to_show, pp_limits_buffer, mip, mi, show_frame_mi, above_context, postproc_state, temp_scale_frame, post_proc_buffer, post_proc_buffer_int, error, yv12_fb, Width, Height, horiz_scale, vert_scale, clamp_type, new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx, post_proc_buffer_int_used, last_frame_type, frame_type, show_frame, frame_flags, MBs, mb_rows, mb_cols, mode_info_stride, mb_no_coeff_skip, no_lpf, use_bilinear_mc_filter, full_pixel, base_qindex, y1dc_delta_q, y2dc_delta_q, y2ac_delta_q, uvdc_delta_q, uvac_delta_q, filter_type, filter_level, last_sharpness_level, sharpness_level, refresh_last_frame, refresh_golden_frame, refresh_alt_ref_frame, copy_buffer_to_gf, copy_buffer_to_arf, refresh_entropy_probs, current_video_frame, version, multi_token_partition, processor_core_count, fb_idx_ref_cnt, ref_frame_sign_bias, left_context, lfc, fc, consider reordering the fields or adding explicit padding members

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name alloccommon.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libvpx -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libvpx -resource-dir /usr/lib/llvm-21/lib/clang/21 -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D _GLIBCXX_ASSERTIONS -D DEBUG=1 -D HAVE_CONFIG_H=vpx_config.h -D MOZ_HAS_MOZGLUE -I /root/firefox-clang/media/libvpx -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libvpx -I /root/firefox-clang/media/libvpx/config/linux/x64 -I /root/firefox-clang/media/libvpx/config -I /root/firefox-clang/media/libvpx/libvpx -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/llvm-21/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-error=tautological-type-limit-compare -Wno-range-loop-analysis -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-unknown-warning-option -Wno-sign-compare -Wno-unused-function -Wno-unreachable-code -Wno-unneeded-internal-declaration -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2025-06-27-100320-3286336-1 -x c /root/firefox-clang/media/libvpx/libvpx/vp8/common/alloccommon.c
1/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef VPX_VP8_COMMON_ONYXC_INT_H_
12#define VPX_VP8_COMMON_ONYXC_INT_H_
13
14#include "vpx_config.h"
15#include "vp8_rtcd.h"
16#include "vpx/internal/vpx_codec_internal.h"
17#include "loopfilter.h"
18#include "entropymv.h"
19#include "entropy.h"
20#if CONFIG_POSTPROC1
21#include "postproc.h"
22#endif
23
24/*#ifdef PACKET_TESTING*/
25#include "header.h"
26/*#endif*/
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#define MINQ0 0
33#define MAXQ127 127
34#define QINDEX_RANGE(127 + 1) (MAXQ127 + 1)
35
36#define NUM_YV12_BUFFERS4 4
37
38#define MAX_PARTITIONS9 9
39
40typedef struct frame_contexts {
41 vp8_prob bmode_prob[VP8_BINTRAMODES(B_HU_PRED + 1) - 1];
42 vp8_prob ymode_prob[VP8_YMODES(B_PRED + 1) - 1]; /* interframe intra mode probs */
43 vp8_prob uv_mode_prob[VP8_UV_MODES(TM_PRED + 1) - 1];
44 vp8_prob sub_mv_ref_prob[VP8_SUBMVREFS(1 + NEW4X4 - LEFT4X4) - 1];
45 vp8_prob coef_probs[BLOCK_TYPES4][COEF_BANDS8][PREV_COEF_CONTEXTS3]
46 [ENTROPY_NODES11];
47 MV_CONTEXT mvc[2];
48} FRAME_CONTEXT;
49
50typedef enum {
51 ONE_PARTITION = 0,
52 TWO_PARTITION = 1,
53 FOUR_PARTITION = 2,
54 EIGHT_PARTITION = 3
55} TOKEN_PARTITION;
56
57typedef enum {
58 RECON_CLAMP_REQUIRED = 0,
59 RECON_CLAMP_NOTREQUIRED = 1
60} CLAMP_TYPE;
61
62typedef struct VP8Common {
Excessive padding in 'struct VP8Common' (37 padding bytes, where 5 is optimal). Optimal fields order: Y1dequant, Y2dequant, UVdequant, lf_info, frame_to_show, pp_limits_buffer, mip, mi, show_frame_mi, above_context, postproc_state, temp_scale_frame, post_proc_buffer, post_proc_buffer_int, error, yv12_fb, Width, Height, horiz_scale, vert_scale, clamp_type, new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx, post_proc_buffer_int_used, last_frame_type, frame_type, show_frame, frame_flags, MBs, mb_rows, mb_cols, mode_info_stride, mb_no_coeff_skip, no_lpf, use_bilinear_mc_filter, full_pixel, base_qindex, y1dc_delta_q, y2dc_delta_q, y2ac_delta_q, uvdc_delta_q, uvac_delta_q, filter_type, filter_level, last_sharpness_level, sharpness_level, refresh_last_frame, refresh_golden_frame, refresh_alt_ref_frame, copy_buffer_to_gf, copy_buffer_to_arf, refresh_entropy_probs, current_video_frame, version, multi_token_partition, processor_core_count, fb_idx_ref_cnt, ref_frame_sign_bias, left_context, lfc, fc, consider reordering the fields or adding explicit padding members
63 struct vpx_internal_error_info error;
64
65 DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][2])short Y1dequant[(127 + 1)][2] __attribute__((aligned(16)));
66 DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][2])short Y2dequant[(127 + 1)][2] __attribute__((aligned(16)));
67 DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][2])short UVdequant[(127 + 1)][2] __attribute__((aligned(16)));
68
69 int Width;
70 int Height;
71 int horiz_scale;
72 int vert_scale;
73
74 CLAMP_TYPE clamp_type;
75
76 YV12_BUFFER_CONFIG *frame_to_show;
77
78 YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS4];
79 int fb_idx_ref_cnt[NUM_YV12_BUFFERS4];
80 int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx;
81
82 YV12_BUFFER_CONFIG temp_scale_frame;
83
84#if CONFIG_POSTPROC1
85 YV12_BUFFER_CONFIG post_proc_buffer;
86 YV12_BUFFER_CONFIG post_proc_buffer_int;
87 int post_proc_buffer_int_used;
88 unsigned char *pp_limits_buffer; /* post-processing filter coefficients */
89#endif
90
91 FRAME_TYPE
92 last_frame_type; /* Save last frame's frame type for motion search. */
93 FRAME_TYPE frame_type;
94
95 int show_frame;
96
97 int frame_flags;
98 int MBs;
99 int mb_rows;
100 int mb_cols;
101 int mode_info_stride;
102
103 /* profile settings */
104 int mb_no_coeff_skip;
105 int no_lpf;
106 int use_bilinear_mc_filter;
107 int full_pixel;
108
109 int base_qindex;
110
111 int y1dc_delta_q;
112 int y2dc_delta_q;
113 int y2ac_delta_q;
114 int uvdc_delta_q;
115 int uvac_delta_q;
116
117 /* We allocate a MODE_INFO struct for each macroblock, together with
118 an extra row on top and column on the left to simplify prediction. */
119
120 MODE_INFO *mip; /* Base of allocated array */
121 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
122#if CONFIG_ERROR_CONCEALMENT0
123 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
124 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
125#endif
126 /* MODE_INFO for the last decoded frame to show */
127 MODE_INFO *show_frame_mi;
128 LOOPFILTERTYPE filter_type;
129
130 loop_filter_info_n lf_info;
131
132 int filter_level;
133 int last_sharpness_level;
134 int sharpness_level;
135
136 int refresh_last_frame; /* Two state 0 = NO, 1 = YES */
137 int refresh_golden_frame; /* Two state 0 = NO, 1 = YES */
138 int refresh_alt_ref_frame; /* Two state 0 = NO, 1 = YES */
139
140 int copy_buffer_to_gf; /* 0 none, 1 Last to GF, 2 ARF to GF */
141 int copy_buffer_to_arf; /* 0 none, 1 Last to ARF, 2 GF to ARF */
142
143 int refresh_entropy_probs; /* Two state 0 = NO, 1 = YES */
144
145 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
146
147 /* Y,U,V,Y2 */
148 ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */
149 ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */
150
151 FRAME_CONTEXT lfc; /* last frame entropy */
152 FRAME_CONTEXT fc; /* this frame entropy */
153
154 unsigned int current_video_frame;
155
156 int version;
157
158 TOKEN_PARTITION multi_token_partition;
159
160#ifdef PACKET_TESTING
161 VP8_HEADER oh;
162#endif
163
164#if CONFIG_MULTITHREAD1
165 int processor_core_count;
166#endif
167#if CONFIG_POSTPROC1
168 struct postproc_state postproc_state;
169#endif
170} VP8_COMMON;
171
172#ifdef __cplusplus
173} // extern "C"
174#endif
175
176#endif // VPX_VP8_COMMON_ONYXC_INT_H_