Bug Summary

File:root/firefox-clang/media/libvpx/libvpx/vp8/decoder/onyxd_int.h
Warning:line 59, column 16
Excessive padding in 'struct VP8D_COMP' (32 padding bytes, where 0 is optimal). Optimal fields order: mb, common, mt_current_mb_col, mt_yabove_row, mt_uabove_row, mt_vabove_row, mt_yleft_col, mt_uleft_col, mt_vleft_col, mb_row_di, de_thread_data, h_decoding_thread, h_event_start_decoding, decrypt_cb, decrypt_state, dec_fb_ref, h_event_end_decoding, fragments, mbc, b_multithreaded_rd, max_threads, current_mb_col_main, decoding_thread_count, allocated_decoding_thread_count, sync_range, ready_for_new_data, ec_enabled, ec_active, decoded_key_frame, independent_partitions, frame_corrupt_residual, restart_threads, mt_baseline_filter_level, oxcf, prob_intra, prob_last, prob_gf, prob_skip_false, 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 decodeframe.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/decoder/decodeframe.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_DECODER_ONYXD_INT_H_
12#define VPX_VP8_DECODER_ONYXD_INT_H_
13
14#include <assert.h>
15
16#include "vpx_config.h"
17#include "vpx_util/vpx_pthread.h"
18#include "vp8/common/onyxd.h"
19#include "treereader.h"
20#include "vp8/common/onyxc_int.h"
21#include "vp8/common/threading.h"
22
23#if CONFIG_ERROR_CONCEALMENT0
24#include "ec_types.h"
25#endif
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31typedef struct {
32 int ithread;
33 void *ptr1;
34 void *ptr2;
35} DECODETHREAD_DATA;
36
37typedef struct {
38 MACROBLOCKD mbd;
39} MB_ROW_DEC;
40
41typedef struct {
42 int enabled;
43 unsigned int count;
44 const unsigned char *ptrs[MAX_PARTITIONS9];
45 unsigned int sizes[MAX_PARTITIONS9];
46} FRAGMENT_DATA;
47
48#define MAX_FB_MT_DEC32 32
49
50struct frame_buffers {
51 /*
52 * this struct will be populated with frame buffer management
53 * info in future commits. */
54
55 /* decoder instances */
56 struct VP8D_COMP *pbi[MAX_FB_MT_DEC32];
57};
58
59typedef struct VP8D_COMP {
Excessive padding in 'struct VP8D_COMP' (32 padding bytes, where 0 is optimal). Optimal fields order: mb, common, mt_current_mb_col, mt_yabove_row, mt_uabove_row, mt_vabove_row, mt_yleft_col, mt_uleft_col, mt_vleft_col, mb_row_di, de_thread_data, h_decoding_thread, h_event_start_decoding, decrypt_cb, decrypt_state, dec_fb_ref, h_event_end_decoding, fragments, mbc, b_multithreaded_rd, max_threads, current_mb_col_main, decoding_thread_count, allocated_decoding_thread_count, sync_range, ready_for_new_data, ec_enabled, ec_active, decoded_key_frame, independent_partitions, frame_corrupt_residual, restart_threads, mt_baseline_filter_level, oxcf, prob_intra, prob_last, prob_gf, prob_skip_false, consider reordering the fields or adding explicit padding members
60 DECLARE_ALIGNED(16, MACROBLOCKD, mb)MACROBLOCKD mb __attribute__((aligned(16)));
61
62 YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS4];
63
64 DECLARE_ALIGNED(16, VP8_COMMON, common)VP8_COMMON common __attribute__((aligned(16)));
65
66 /* the last partition will be used for the modes/mvs */
67 vp8_reader mbc[MAX_PARTITIONS9];
68
69 VP8D_CONFIG oxcf;
70
71 FRAGMENT_DATA fragments;
72
73#if CONFIG_MULTITHREAD1
74 /* variable for threading */
75
76 vpx_atomic_int b_multithreaded_rd;
77 int max_threads;
78 int current_mb_col_main;
79 unsigned int decoding_thread_count;
80 int allocated_decoding_thread_count;
81
82 int mt_baseline_filter_level[MAX_MB_SEGMENTS4];
83 int sync_range;
84 /* Each row remembers its already decoded column. */
85 vpx_atomic_int *mt_current_mb_col;
86
87 unsigned char **mt_yabove_row; /* mb_rows x width */
88 unsigned char **mt_uabove_row;
89 unsigned char **mt_vabove_row;
90 unsigned char **mt_yleft_col; /* mb_rows x 16 */
91 unsigned char **mt_uleft_col; /* mb_rows x 8 */
92 unsigned char **mt_vleft_col; /* mb_rows x 8 */
93
94 MB_ROW_DEC *mb_row_di;
95 DECODETHREAD_DATA *de_thread_data;
96
97 pthread_t *h_decoding_thread;
98 vp8_sem_tsem_t *h_event_start_decoding;
99 vp8_sem_tsem_t h_event_end_decoding;
100/* end of threading data */
101#endif
102
103 int ready_for_new_data;
104
105 vp8_prob prob_intra;
106 vp8_prob prob_last;
107 vp8_prob prob_gf;
108 vp8_prob prob_skip_false;
109
110#if CONFIG_ERROR_CONCEALMENT0
111 MB_OVERLAP *overlaps;
112 /* the mb num from which modes and mvs (first partition) are corrupt */
113 unsigned int mvs_corrupt_from_mb;
114#endif
115 int ec_enabled;
116 int ec_active;
117 int decoded_key_frame;
118 int independent_partitions;
119 int frame_corrupt_residual;
120
121 vpx_decrypt_cb decrypt_cb;
122 void *decrypt_state;
123#if CONFIG_MULTITHREAD1
124 // Restart threads on next frame if set to 1.
125 // This is set when error happens in multithreaded decoding and all threads
126 // are shut down.
127 int restart_threads;
128#endif
129} VP8D_COMP;
130
131void vp8cx_init_de_quantizer(VP8D_COMP *pbi);
132void vp8_mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd);
133int vp8_decode_frame(VP8D_COMP *pbi);
134
135int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf);
136int vp8_remove_decoder_instances(struct frame_buffers *fb);
137
138#ifdef __cplusplus
139} // extern "C"
140#endif
141
142#endif // VPX_VP8_DECODER_ONYXD_INT_H_