#define OPJ_SKIP_POISON
#include "opj_includes.h"
#ifdef __SSE__
#include <xmmintrin.h>
#endif
#ifdef __SSE2__
#include <emmintrin.h>
#endif
#if defined(__GNUC__)
#pragma GCC poison malloc calloc realloc free
#endif
#include "t1_luts.h"
#define T1_FLAGS(x, y) …
#define opj_t1_setcurctx(curctx, ctxno) …
#define opj_smr_abs(x) …
#define opj_smr_sign(x) …
#define opj_to_smr(x) …
static INLINE OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f);
static INLINE OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f);
static OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos);
static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos);
static INLINE void opj_t1_update_flags(opj_flag_t *flagsp, OPJ_UINT32 ci,
OPJ_UINT32 s, OPJ_UINT32 stride,
OPJ_UINT32 vsc);
static INLINE void opj_t1_dec_sigpass_step_raw(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 oneplushalf,
OPJ_UINT32 vsc,
OPJ_UINT32 row);
static INLINE void opj_t1_dec_sigpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 oneplushalf,
OPJ_UINT32 row,
OPJ_UINT32 flags_stride,
OPJ_UINT32 vsc);
static void opj_t1_enc_sigpass(opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
OPJ_BYTE type,
OPJ_UINT32 cblksty);
static void opj_t1_dec_sigpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 cblksty);
static void opj_t1_enc_refpass(opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
OPJ_BYTE type);
static void opj_t1_dec_refpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno);
static INLINE void opj_t1_dec_refpass_step_raw(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 poshalf,
OPJ_UINT32 row);
static INLINE void opj_t1_dec_refpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 poshalf,
OPJ_UINT32 row);
static void opj_t1_dec_clnpass_step(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 oneplushalf,
OPJ_UINT32 row,
OPJ_UINT32 vsc);
static void opj_t1_enc_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
OPJ_UINT32 cblksty);
static OPJ_FLOAT64 opj_t1_getwmsedec(
OPJ_INT32 nmsedec,
OPJ_UINT32 compno,
OPJ_UINT32 level,
OPJ_UINT32 orient,
OPJ_INT32 bpno,
OPJ_UINT32 qmfbid,
OPJ_FLOAT64 stepsize,
OPJ_UINT32 numcomps,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps);
static double opj_t1_encode_cblk(opj_t1_t *t1,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 compno,
OPJ_UINT32 level,
OPJ_UINT32 qmfbid,
OPJ_FLOAT64 stepsize,
OPJ_UINT32 cblksty,
OPJ_UINT32 numcomps,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps);
static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1,
opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 roishift,
OPJ_UINT32 cblksty,
opj_event_mgr_t *p_manager,
opj_mutex_t* p_manager_mutex,
OPJ_BOOL check_pterm);
OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 roishift,
OPJ_UINT32 cblksty,
opj_event_mgr_t *p_manager,
opj_mutex_t* p_manager_mutex,
OPJ_BOOL check_pterm);
static OPJ_BOOL opj_t1_allocate_buffers(opj_t1_t *t1,
OPJ_UINT32 w,
OPJ_UINT32 h);
static INLINE OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f)
{ … }
static INLINE OPJ_UINT32 opj_t1_getctxtno_sc_or_spb_index(OPJ_UINT32 fX,
OPJ_UINT32 pfX,
OPJ_UINT32 nfX,
OPJ_UINT32 ci)
{ … }
static INLINE OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 lu)
{ … }
static INLINE OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f)
{ … }
static INLINE OPJ_BYTE opj_t1_getspb(OPJ_UINT32 lu)
{ … }
static OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos)
{ … }
static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos)
{ … }
#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) …
static INLINE void opj_t1_update_flags(opj_flag_t *flagsp, OPJ_UINT32 ci,
OPJ_UINT32 s, OPJ_UINT32 stride,
OPJ_UINT32 vsc)
{ … }
#define opj_t1_enc_sigpass_step_macro(mqc, curctx, a, c, ct, flagspIn, datapIn, bpno, one, nmsedec, type, ciIn, vscIn) …
static INLINE void opj_t1_dec_sigpass_step_raw(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 oneplushalf,
OPJ_UINT32 vsc,
OPJ_UINT32 ci)
{ … }
#define opj_t1_dec_sigpass_step_mqc_macro(flags, flagsp, flags_stride, data, \
data_stride, ci, mqc, curctx, \
v, a, c, ct, oneplushalf, vsc) …
static INLINE void opj_t1_dec_sigpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 oneplushalf,
OPJ_UINT32 ci,
OPJ_UINT32 flags_stride,
OPJ_UINT32 vsc)
{ … }
static void opj_t1_enc_sigpass(opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
OPJ_BYTE type,
OPJ_UINT32 cblksty
)
{ … }
static void opj_t1_dec_sigpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 cblksty)
{ … }
#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) …
static void opj_t1_dec_sigpass_mqc_64x64_novsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_sigpass_mqc_64x64_vsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_sigpass_mqc_generic_novsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_sigpass_mqc_generic_vsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_sigpass_mqc(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 cblksty)
{ … }
#define opj_t1_enc_refpass_step_macro(mqc, curctx, a, c, ct, flags, flagsUpdated, datap, bpno, one, nmsedec, type, ci) …
static INLINE void opj_t1_dec_refpass_step_raw(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 poshalf,
OPJ_UINT32 ci)
{ … }
#define opj_t1_dec_refpass_step_mqc_macro(flags, data, data_stride, ci, \
mqc, curctx, v, a, c, ct, poshalf) …
static INLINE void opj_t1_dec_refpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 poshalf,
OPJ_UINT32 ci)
{ … }
static void opj_t1_enc_refpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
OPJ_BYTE type)
{ … }
static void opj_t1_dec_refpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) …
static void opj_t1_dec_refpass_mqc_64x64(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_refpass_mqc_generic(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_refpass_mqc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
#define opj_t1_enc_clnpass_step_macro(mqc, curctx, a, c, ct, flagspIn, datapIn, bpno, one, nmsedec, agg, runlen, lim, cblksty) …
#define opj_t1_dec_clnpass_step_macro(check_flags, partial, \
flags, flagsp, flags_stride, data, \
data_stride, ci, mqc, curctx, \
v, a, c, ct, oneplushalf, vsc) …
static void opj_t1_dec_clnpass_step(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 oneplushalf,
OPJ_UINT32 ci,
OPJ_UINT32 vsc)
{ … }
static void opj_t1_enc_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
OPJ_UINT32 cblksty)
{ … }
#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) …
static void opj_t1_dec_clnpass_check_segsym(opj_t1_t *t1, OPJ_INT32 cblksty)
{ … }
static void opj_t1_dec_clnpass_64x64_novsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_clnpass_64x64_vsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_clnpass_generic_novsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_clnpass_generic_vsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{ … }
static void opj_t1_dec_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 cblksty)
{ … }
static OPJ_FLOAT64 opj_t1_getwmsedec(
OPJ_INT32 nmsedec,
OPJ_UINT32 compno,
OPJ_UINT32 level,
OPJ_UINT32 orient,
OPJ_INT32 bpno,
OPJ_UINT32 qmfbid,
OPJ_FLOAT64 stepsize,
OPJ_UINT32 numcomps,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps)
{ … }
static OPJ_BOOL opj_t1_allocate_buffers(
opj_t1_t *t1,
OPJ_UINT32 w,
OPJ_UINT32 h)
{ … }
opj_t1_t* opj_t1_create(OPJ_BOOL isEncoder)
{ … }
void opj_t1_destroy(opj_t1_t *p_t1)
{ … }
opj_t1_cblk_decode_processing_job_t;
static void opj_t1_destroy_wrapper(void* t1)
{ … }
static void opj_t1_clbl_decode_processor(void* user_data, opj_tls_t* tls)
{ … }
void opj_t1_decode_cblks(opj_tcd_t* tcd,
volatile OPJ_BOOL* pret,
opj_tcd_tilecomp_t* tilec,
opj_tccp_t* tccp,
opj_event_mgr_t *p_manager,
opj_mutex_t* p_manager_mutex,
OPJ_BOOL check_pterm
)
{ … }
static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1,
opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 roishift,
OPJ_UINT32 cblksty,
opj_event_mgr_t *p_manager,
opj_mutex_t* p_manager_mutex,
OPJ_BOOL check_pterm)
{ … }
opj_t1_cblk_encode_processing_job_t;
static void opj_t1_cblk_encode_processor(void* user_data, opj_tls_t* tls)
{ … }
OPJ_BOOL opj_t1_encode_cblks(opj_tcd_t* tcd,
opj_tcd_tile_t *tile,
opj_tcp_t *tcp,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps
)
{ … }
static int opj_t1_enc_is_term_pass(opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 cblksty,
OPJ_INT32 bpno,
OPJ_UINT32 passtype)
{ … }
static OPJ_FLOAT64 opj_t1_encode_cblk(opj_t1_t *t1,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 compno,
OPJ_UINT32 level,
OPJ_UINT32 qmfbid,
OPJ_FLOAT64 stepsize,
OPJ_UINT32 cblksty,
OPJ_UINT32 numcomps,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps)
{ … }