summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/t1.h
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2016-05-23 01:33:06 +0200
committerEven Rouault <even.rouault@spatialys.com>2016-05-23 11:53:53 +0200
commit1da397e94a4e441a7c9a1aa4c2debd1c06ba05e2 (patch)
treedd7d32570aec748f51b4f416d93a333415538c3c /src/lib/openjp2/t1.h
parent31882ad7f4a0d9d0231c3fdb9c75a6b69912e1b7 (diff)
Tier 1 decoding: add a colflags array
Addition flag array such that colflags[1+0] is for state of col=0,row=0..3, colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ... This array avoids too much cache trashing when processing by 4 vertical samples as done in the various decoding steps.
Diffstat (limited to 'src/lib/openjp2/t1.h')
-rw-r--r--src/lib/openjp2/t1.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/lib/openjp2/t1.h b/src/lib/openjp2/t1.h
index e9d3db57..22557d96 100644
--- a/src/lib/openjp2/t1.h
+++ b/src/lib/openjp2/t1.h
@@ -52,6 +52,7 @@ in T1.C are used by some function in TCD.C.
/* CAUTION: the value of those constants must not be changed, otherwise the */
/* optimization of opj_t1_updateflags() will break! */
+/* BEGINNING of flags that apply to opj_flag_t */
#define T1_SIG_NE 0x0001 /**< Context orientation : North-East direction */
#define T1_SIG_SE 0x0002 /**< Context orientation : South-East direction */
#define T1_SIG_SW 0x0004 /**< Context orientation : South-West direction */
@@ -69,9 +70,10 @@ in T1.C are used by some function in TCD.C.
#define T1_SGN_W 0x0800
#define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
-#define T1_SIG 0x1000
-#define T1_REFINE 0x2000
-#define T1_VISIT 0x4000
+#define T1_SIG 0x1000 /**< No longer used by decoder */
+#define T1_REFINE 0x2000 /**< No longer used by decoder */
+#define T1_VISIT 0x4000 /**< No longer used by decoder */
+/* END of flags that apply to opj_flag_t */
#define T1_NUMCTXS_ZC 9
#define T1_NUMCTXS_SC 5
@@ -91,10 +93,32 @@ in T1.C are used by some function in TCD.C.
#define T1_TYPE_MQ 0 /**< Normal coding using entropy coder */
#define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
+/* Those flags are used by opj_colflag_t */
+#define T1_COLFLAG_RBS 4 /* RBS = Row Bit Shift */
+#define T1_COLFLAG_SIG_OTHER_ROW_0 (1 << 0) /**< This sample has at least one significant neighbour */
+#define T1_COLFLAG_SIG_ROW_0 (1 << 1) /**< This sample is significant */
+#define T1_COLFLAG_VISIT_ROW_0 (1 << 2) /**< This sample has been visited */
+#define T1_COLFLAG_REFINE_ROW_0 (1 << 3) /**< This sample has been refined */
+#define T1_COLFLAG_SIG_OTHER_ROW_1 (T1_COLFLAG_SIG_OTHER_ROW_0 << T1_COLFLAG_RBS)
+#define T1_COLFLAG_SIG_ROW_1 (T1_COLFLAG_SIG_ROW_0 << T1_COLFLAG_RBS)
+#define T1_COLFLAG_VISIT_ROW_1 (T1_COLFLAG_VISIT_ROW_0 << T1_COLFLAG_RBS)
+#define T1_COLFLAG_REFINE_ROW_1 (T1_COLFLAG_REFINE_ROW_0 << T1_COLFLAG_RBS)
+#define T1_COLFLAG_SIG_OTHER_ROW_2 (T1_COLFLAG_SIG_OTHER_ROW_0 << (2*T1_COLFLAG_RBS))
+#define T1_COLFLAG_SIG_ROW_2 (T1_COLFLAG_SIG_ROW_0 << (2*T1_COLFLAG_RBS))
+#define T1_COLFLAG_VISIT_ROW_2 (T1_COLFLAG_VISIT_ROW_0 << (2*T1_COLFLAG_RBS))
+#define T1_COLFLAG_REFINE_ROW_2 (T1_COLFLAG_REFINE_ROW_0 << (2*T1_COLFLAG_RBS))
+#define T1_COLFLAG_SIG_OTHER_ROW_3 (T1_COLFLAG_SIG_OTHER_ROW_0 << (3*T1_COLFLAG_RBS))
+#define T1_COLFLAG_SIG_ROW_3 (T1_COLFLAG_SIG_ROW_0 << (3*T1_COLFLAG_RBS))
+#define T1_COLFLAG_VISIT_ROW_3 (T1_COLFLAG_VISIT_ROW_0 << (3*T1_COLFLAG_RBS))
+#define T1_COLFLAG_REFINE_ROW_3 (T1_COLFLAG_REFINE_ROW_0 << (3*T1_COLFLAG_RBS))
+
/* ----------------------------------------------------------------------- */
typedef OPJ_INT16 opj_flag_t;
+/** Flags for 4 consecutive rows of a column */
+typedef OPJ_UINT16 opj_colflag_t;
+
/**
Tier-1 coding (coding of code-block coefficients)
*/
@@ -107,11 +131,17 @@ typedef struct opj_t1 {
OPJ_INT32 *data;
opj_flag_t *flags;
+ /** Addition flag array such that colflags[1+0] is for state of col=0,row=0..3,
+ colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ...
+ This array avoids too much cache trashing when processing by 4 vertical samples
+ as done in the various decoding steps. */
+ opj_colflag_t* colflags;
OPJ_UINT32 w;
OPJ_UINT32 h;
OPJ_UINT32 datasize;
OPJ_UINT32 flagssize;
OPJ_UINT32 flags_stride;
+ OPJ_UINT32 colflags_size;
OPJ_UINT32 data_stride;
OPJ_BOOL encoder;
} opj_t1_t;