Content-Type: multipart/mixed; boundary="===============9006667769201227968==" MIME-Version: 1.0 From: Li Zhang Subject: [Accel-config] [PATCH RESEND v1 04/14] accel-config/test: Add algorithm to do Zdecompress32 Date: Tue, 07 Jun 2022 10:58:24 +0800 Message-ID: <20220607025834.1740551-5-li4.zhang@intel.com> In-Reply-To: 20220607025834.1740551-1-li4.zhang@intel.com To: accel-config@lists.01.org List-ID: --===============9006667769201227968== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add an algorithm to implement Zdecompress32, it is used to generate a reference data for comparing with the result from IAA hardware. Signed-off-by: Li Zhang --- test/algorithms/iaa_zcompress.c | 32 ++++++++++++++++++++++++++++++++ test/algorithms/iaa_zcompress.h | 1 + 2 files changed, 33 insertions(+) diff --git a/test/algorithms/iaa_zcompress.c b/test/algorithms/iaa_zcompres= s.c index 1126466..d3d47e8 100644 --- a/test/algorithms/iaa_zcompress.c +++ b/test/algorithms/iaa_zcompress.c @@ -164,3 +164,35 @@ int iaa_do_zdecompress16(void *dst, void *src, int src= _len) = return dst_len; } + +int iaa_do_zdecompress32(void *dst, void *src, int src_len) +{ + int i, j, dst_len =3D 0; + uint32_t tags; + int remainder_len =3D src_len; + uint32_t *src_ptr =3D (uint32_t *)src; + uint32_t *dst_ptr =3D (uint32_t *)dst; + + for (i =3D 0; i < (src_len / 4); i++) { + tags =3D *src_ptr++; + remainder_len -=3D 4; + + for (j =3D 0; j < 32; j++) { + if (tags & ((uint32_t)1 << j)) { + if (remainder_len <=3D 0) + break; + *dst_ptr++ =3D *src_ptr++; + remainder_len -=3D 4; + } else { + *dst_ptr++ =3D 0; + } + + dst_len +=3D 4; + } + + if (remainder_len <=3D 0) + break; + } + + return dst_len; +} diff --git a/test/algorithms/iaa_zcompress.h b/test/algorithms/iaa_zcompres= s.h index a2b37e9..357b558 100644 --- a/test/algorithms/iaa_zcompress.h +++ b/test/algorithms/iaa_zcompress.h @@ -9,5 +9,6 @@ void iaa_zcompress16_randomize_input(void *dst, uint64_t pa= ttern, int len); int iaa_do_zcompress16(void *dst, void *src, int src_len); int iaa_do_zdecompress16(void *dst, void *src, int src_len); int iaa_do_zcompress32(void *dst, void *src, int src_len); +int iaa_do_zdecompress32(void *dst, void *src, int src_len); = #endif -- = 2.25.1 --===============9006667769201227968==--