From f9eb8f93c29679657d539b8d17e56d889d816a2e Mon Sep 17 00:00:00 2001 From: Francois-Olivier Devaux Date: Tue, 24 May 2005 12:15:52 +0000 Subject: [PATCH] Code optimization: t1_flags and t1_data set to zero with memset --- libopenjpeg/t1.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c index be79c436..f5513ba4 100644 --- a/libopenjpeg/t1.c +++ b/libopenjpeg/t1.c @@ -37,6 +37,7 @@ #include #include #include +#include #define T1_MAXCBLKW 1024 #define T1_MAXCBLKH 1024 @@ -573,8 +574,8 @@ void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qm cblk->numbps = max ? (int_floorlog2(max) + 1) - T1_NMSEDEC_FRACBITS : 0; - for (i = 0; i < sizeof(t1_flags) / sizeof(int); i++) - ((int *) t1_flags)[i] = 0; + memset(t1_flags,0,sizeof(t1_flags)); + bpno = cblk->numbps - 1; passtype = 2; @@ -677,16 +678,13 @@ void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qm void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift, int cblksty) { - int i; int w, h; int bpno, passtype; int segno, passno; char type = T1_TYPE_MQ; //BYPASS mode - - for (i = 0; i < sizeof(t1_data) / sizeof(int); i++) - ((int *) t1_data)[i] = 0; - for (i = 0; i < sizeof(t1_flags) / sizeof(int); i++) - ((int *) t1_flags)[i] = 0; + + memset(t1_data,0,sizeof(t1_data)); + memset(t1_flags,0,sizeof(t1_flags)); w = cblk->x1 - cblk->x0; h = cblk->y1 - cblk->y0;