summaryrefslogtreecommitdiff
path: root/libavcodec/snowdata.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-02 03:52:40 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-05-02 05:14:42 +0200
commita7f4abbc62cb6b768c9bcb927ba2485ba6e61913 (patch)
tree2995d2f17dd43fcede383b8f8ecf0804389cdbf2 /libavcodec/snowdata.h
parent56df06dd8346687d6d9b7321f2af41e4fd614ee3 (diff)
avcodec/snow: Hardcode table to save space
The size of ff_qexp is only 32 bytes, but the code to generate it at runtime takes 47 bytes (GCC 9.3, x64, -O3 in an av_cold function); so just hardcode it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/snowdata.h')
-rw-r--r--libavcodec/snowdata.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/snowdata.h b/libavcodec/snowdata.h
index 490fdf8bd6..ca0c1e3f7a 100644
--- a/libavcodec/snowdata.h
+++ b/libavcodec/snowdata.h
@@ -124,8 +124,14 @@ const uint8_t * const ff_obmc_tab[4]= {
obmc32, obmc16, obmc8, obmc4
};
-/* runtime generated tables */
-uint8_t ff_qexp[QROOT];
+/* ff_qexp[i] = lrintf(128 * 2^(i / QROOT)) with QROOT = 32 */
+const uint8_t ff_qexp[QROOT] = {
+ 128, 131, 134, 137, 140, 143, 146, 149, 152, 156, 159,
+ 162, 166, 170, 173, 177, 181, 185, 189, 193, 197, 202,
+ 206, 211, 215, 220, 225, 230, 235, 240, 245, 251,
+};
+
+/* table generated at runtime */
int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];