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 debugmodes.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/libaom -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libaom -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 MOZ_HAS_MOZGLUE -I /root/firefox-clang/media/libaom -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libaom -I /root/firefox-clang/media/libaom/config/linux/x64 -I /root/firefox-clang/media/libaom/config -I /root/firefox-clang/third_party/aom -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/third_party/aom/av1/common/debugmodes.c
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | #include "av1/common/debugmodes.h" |
13 | |
14 | #include <stdio.h> |
15 | |
16 | #include "av1/common/av1_common_int.h" |
17 | #include "av1/common/blockd.h" |
18 | #include "av1/common/enums.h" |
19 | |
20 | #if 0 |
21 | static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) { |
22 | fprintf(f, "%s", str); |
23 | fprintf(f, "(Frame %u, Show:%d, Q:%d): \n", cm->current_frame.frame_number, |
24 | cm->show_frame, cm->quant_params.base_qindex); |
25 | } |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor, |
32 | size_t member_offset) { |
33 | const CommonModeInfoParams *const mi_params = &cm->mi_params; |
34 | MB_MODE_INFO **mi = mi_params->mi_grid_base; |
35 | int rows = mi_params->mi_rows; |
36 | int cols = mi_params->mi_cols; |
37 | char prefix = descriptor[0]; |
38 | |
39 | log_frame_info(cm, descriptor, file); |
40 | for (int mi_row = 0; mi_row < rows; mi_row++) { |
41 | fprintf(file, "%c ", prefix); |
42 | for (int mi_col = 0; mi_col < cols; mi_col++) { |
43 | fprintf(file, "%2d ", *((char *)((char *)(mi[0]) + member_offset))); |
44 | mi++; |
45 | } |
46 | fprintf(file, "\n"); |
47 | mi += mi_params->mi_stride - cols; |
48 | } |
49 | fprintf(file, "\n"); |
50 | } |
51 | |
52 | void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) { |
53 | CommonModeInfoParams *mi_params = &cm->mi_params; |
54 | FILE *mvs = fopen(file, "a"); |
55 | MB_MODE_INFO **mi = mi_params->mi_grid_base; |
56 | const int rows = mi_params->mi_rows; |
57 | const int cols = mi_params->mi_cols; |
58 | |
59 | print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, bsize)); |
60 | print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); |
61 | print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); |
62 | print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size)); |
63 | print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode)); |
64 | |
65 | |
66 | log_frame_info(cm, "Skips:", mvs); |
67 | for (int mi_row = 0; mi_row < rows; mi_row++) { |
68 | fprintf(mvs, "S "); |
69 | for (int mi_col = 0; mi_col < cols; mi_col++) { |
70 | fprintf(mvs, "%2d ", mi[0]->skip_txfm); |
71 | mi++; |
72 | } |
73 | fprintf(mvs, "\n"); |
74 | mi += mi_params->mi_stride - cols; |
75 | } |
76 | fprintf(mvs, "\n"); |
77 | |
78 | |
79 | log_frame_info(cm, "Vectors ", mvs); |
80 | mi = mi_params->mi_grid_base; |
81 | for (int mi_row = 0; mi_row < rows; mi_row++) { |
82 | fprintf(mvs, "V "); |
83 | for (int mi_col = 0; mi_col < cols; mi_col++) { |
84 | fprintf(mvs, "%4d:%4d ", mi[0]->mv[0].as_mv.row, mi[0]->mv[0].as_mv.col); |
85 | mi++; |
86 | } |
87 | fprintf(mvs, "\n"); |
88 | mi += mi_params->mi_stride - cols; |
89 | } |
90 | fprintf(mvs, "\n"); |
91 | |
92 | fclose(mvs); |
93 | } |
94 | #endif // 0 |
95 | |
96 | void av1_print_uncompressed_frame_header(const uint8_t *data, int size, |
97 | const char *filename) { |
98 | FILE *hdrFile = fopen(filename, "w"); |
| 1 | Assuming pointer value is null | |
|
| 2 | | Assuming that 'fopen' fails | |
|
| 3 | | 'hdrFile' initialized here | |
|
99 | fwrite(data, size, sizeof(uint8_t), hdrFile); |
| 4 | | Null pointer passed to 4th parameter expecting 'nonnull' |
|
100 | |
101 | |
102 | |
103 | uint8_t zero = 0; |
104 | fseek(hdrFile, 1, SEEK_SET); |
105 | |
106 | fwrite(&zero, 1, sizeof(uint8_t), hdrFile); |
107 | fclose(hdrFile); |
108 | } |
109 | |
110 | void av1_print_frame_contexts(const FRAME_CONTEXT *fc, const char *filename) { |
111 | FILE *fcFile = fopen(filename, "w"); |
112 | const uint16_t *fcp = (uint16_t *)fc; |
113 | const unsigned int n_contexts = sizeof(FRAME_CONTEXT) / sizeof(uint16_t); |
114 | unsigned int i; |
115 | |
116 | for (i = 0; i < n_contexts; ++i) fprintf(fcFile, "%d ", *fcp++); |
117 | fclose(fcFile); |
118 | } |