shithub: dav1d

Download patch

ref: d606dd2465d099b5986755b49af0c92ec4b3122f
parent: bc008834b9e9d08f86d18227ca05a251492a0617
author: Henrik Gramner <[email protected]>
date: Thu Jun 11 10:08:45 EDT 2020

Remove redundant memset in itx DSP initialization

The struct is already zero-initialized when the function is called
except for the checkasm test, so move the zeroing there instead.

--- a/src/itx_tmpl.c
+++ b/src/itx_tmpl.c
@@ -224,8 +224,6 @@
     c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
         inv_txfm_add_identity_adst_##w##x##h##_c; \
 
-    memset(c, 0, sizeof(*c)); /* Zero unused function pointer elements. */
-
     c->itxfm_add[TX_4X4][WHT_WHT] = inv_txfm_add_wht_wht_4x4_c;
     assign_itx_all_fn84( 4,  4, );
     assign_itx_all_fn84( 4,  8, R);
--- a/tests/checkasm/itx.c
+++ b/tests/checkasm/itx.c
@@ -232,6 +232,7 @@
     ALIGN_STK_64(coef, coeff, 2, [32 * 32]);
     ALIGN_STK_64(pixel, c_dst, 64 * 64,);
     ALIGN_STK_64(pixel, a_dst, 64 * 64,);
+    Dav1dInvTxfmDSPContext c = { { { 0 } } }; /* Zero unused function pointer elements. */
 
     static const uint8_t txfm_size_order[N_RECT_TX_SIZES] = {
         TX_4X4,   RTX_4X8,  RTX_4X16,
@@ -254,7 +255,6 @@
                                                dav1d_txfm_dimensions[tx].lh)];
 
         for (int bpc = bpc_min; bpc <= bpc_max; bpc += 2) {
-            Dav1dInvTxfmDSPContext c;
             bitfn(dav1d_itx_dsp_init)(&c, bpc);
             for (enum TxfmType txtp = 0; txtp < N_TX_TYPES_PLUS_LL; txtp++)
                 for (int subsh = 0; subsh < subsh_max; subsh++)