feat/api #46

Open
Gregor Weiss wants to merge 55 commits from feat/api into main
4 changed files with 46 additions and 71 deletions
Showing only changes of commit 366827ca4a - Show all commits

View file

@ -228,7 +228,7 @@ codestream_write_header(bitstream *const stream,
emit_symbol(stream, control->tileSizeX, 8);
emit_symbol(stream, control->tileSizeY, 8);
emit_symbol(stream, control->tileSizeZ, 8);
emit_symbol(stream, control->tileSizeTS, 2);
emit_symbol(stream, control->tileSizeTS, 8);
emit_symbol(stream, control->nLayers, 1);
@ -609,7 +609,7 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 buff_long, buffX, buffY, buffZ, buffTS;
uint64 nX, nY, nZ;
uint64 nX, nY, nZ, nTS;
uint32 buff;
uint32 bitrate;
uint32 Lsax;
@ -618,7 +618,6 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
uint16 CSsgc;
uint16 Linf, Lctr, Lcom, Leoh, Lunk;
uint16 marker;
uint16 nTS;
uint8 index, l;
uint8 nPar, p;
bwc_precision data_prec, codec_prec;
@ -811,10 +810,10 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
buffX = get_symbol(stream, 8);
buffY = get_symbol(stream, 8);
buffZ = get_symbol(stream, 8);
buffTS = get_symbol(stream, 2);
buffTS = get_symbol(stream, 8);
if(CSsgc & (0x01 << 9))
{
bwc_set_tiles(codec, buffX, buffY, buffZ, (uint16)buffTS, bwc_tile_sizeof);
bwc_set_tiles(codec, buffX, buffY, buffZ, buffTS, bwc_tile_sizeof);
}
control->nLayers = get_symbol(stream, 1);

View file

@ -1619,23 +1619,17 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 incr_X, incr_Y, incr_Z;
uint64 rX0, rY0, rZ0;
uint64 rX1, rY1, rZ1;
uint64 width, height, depth;
uint64 x, y, z;
uint64 incr_X, incr_Y, incr_Z, incr_TS;
uint64 rX0, rY0, rZ0, rTS0;
uint64 rX1, rY1, rZ1, rTS1;
uint64 width, height, depth, dt;
uint64 x, y, z, t;
int64 nThreads;
int16 i;
uint32 buff_size;
uint16 incr_TS;
uint16 rTS0;
uint16 rTS1;
uint16 dt;
uint16 t;
uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS;
@ -1777,8 +1771,8 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
rY1 = (uint64)parameter->resolution[control->nDecomp - level].info.Y1;
rZ0 = (uint64)parameter->resolution[control->nDecomp - level].info.Z0;
rZ1 = (uint64)parameter->resolution[control->nDecomp - level].info.Z1;
rTS0 = (uint16)parameter->resolution[control->nDecomp - level].info.TS0;
rTS1 = (uint16)parameter->resolution[control->nDecomp - level].info.TS1;
rTS0 = (uint64)parameter->resolution[control->nDecomp - level].info.TS0;
rTS1 = (uint64)parameter->resolution[control->nDecomp - level].info.TS1;
if(level < control->decompX && (rX1 - rX0) > 1)
{
@ -2160,23 +2154,17 @@ inverse_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 incr_X, incr_Y, incr_Z;
uint64 rX0, rY0, rZ0;
uint64 rX1, rY1, rZ1;
uint64 width, height, depth;
uint64 x, y, z;
uint64 incr_X, incr_Y, incr_Z, incr_TS;
uint64 rX0, rY0, rZ0, rTS0;
uint64 rX1, rY1, rZ1, rTS1;
uint64 width, height, depth, dt;
uint64 x, y, z, t;
int64 nThreads;
int64 i;
uint32 buff_size;
uint16 incr_TS;
uint16 rTS0;
uint16 rTS1;
uint16 dt;
uint16 t;
uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS;
@ -2318,8 +2306,8 @@ inverse_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
rY1 = (uint64)parameter->resolution[control->nDecomp - level].info.Y1;
rZ0 = (uint64)parameter->resolution[control->nDecomp - level].info.Z0;
rZ1 = (uint64)parameter->resolution[control->nDecomp - level].info.Z1;
rTS0 = (uint16)parameter->resolution[control->nDecomp - level].info.TS0;
rTS1 = (uint16)parameter->resolution[control->nDecomp - level].info.TS1;
rTS0 = (uint64)parameter->resolution[control->nDecomp - level].info.TS0;
rTS1 = (uint64)parameter->resolution[control->nDecomp - level].info.TS1;
if(level < control->decompTS && (rTS1 - rTS0) > 1)
{

View file

@ -314,11 +314,11 @@ initialize_precinct(bwc_codec *const field, bwc_precinct *precinct, const uint32
cblk_info->X0 = dX + (uint32)MAX(prec_info->X0 , cbSizeX * (cb_X + (uint32)floor((float)prec_info->X0 / cbSizeX )));
cblk_info->Y0 = dY + (uint32)MAX(prec_info->Y0 , cbSizeY * (cb_Y + (uint32)floor((float)prec_info->Y0 / cbSizeY )));
cblk_info->Z0 = dZ + (uint32)MAX(prec_info->Z0 , cbSizeZ * (cb_Z + (uint32)floor((float)prec_info->Z0 / cbSizeZ )));
cblk_info->TS0 = dTS + (uint16)MAX(prec_info->TS0, cbSizeTS * (cb_TS + (uint32)floor((float)prec_info->TS0/ cbSizeTS)));
cblk_info->TS0 = dTS + (uint32)MAX(prec_info->TS0, cbSizeTS * (cb_TS + (uint32)floor((float)prec_info->TS0/ cbSizeTS)));
cblk_info->X1 = dX + (uint32)MIN(prec_info->X1 , cbSizeX * (cb_X + (uint32)floor((float)prec_info->X0 / cbSizeX ) + 1));
cblk_info->Y1 = dY + (uint32)MIN(prec_info->Y1 , cbSizeY * (cb_Y + (uint32)floor((float)prec_info->Y0 / cbSizeY ) + 1));
cblk_info->Z1 = dZ + (uint32)MIN(prec_info->Z1 , cbSizeZ * (cb_Z + (uint32)floor((float)prec_info->Z0 / cbSizeZ ) + 1));
cblk_info->TS1 = dTS + (uint16)MIN(prec_info->TS1, cbSizeTS * (cb_TS + (uint32)floor((float)prec_info->TS0/ cbSizeTS) + 1));
cblk_info->TS1 = dTS + (uint32)MIN(prec_info->TS1, cbSizeTS * (cb_TS + (uint32)floor((float)prec_info->TS0/ cbSizeTS) + 1));
}
}
}
@ -506,11 +506,11 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r
subb_info->X0 = (uint64)ceil( ((float)param_info->X0 / (1 << level_X)) - 0.5 * ((highband_flag & DIM_X) >> 0));
subb_info->Y0 = (uint64)ceil( ((float)param_info->Y0 / (1 << level_Y)) - 0.5 * ((highband_flag & DIM_Y) >> 1));
subb_info->Z0 = (uint64)ceil( ((float)param_info->Z0 / (1 << level_Z)) - 0.5 * ((highband_flag & DIM_Z) >> 2));
subb_info->TS0 = (uint16)ceil( ((float)param_info->TS0 / (1 << level_TS)) - 0.5 * ((highband_flag & DIM_TS) >> 3));
subb_info->TS0 = (uint64)ceil( ((float)param_info->TS0 / (1 << level_TS)) - 0.5 * ((highband_flag & DIM_TS) >> 3));
subb_info->X1 = (uint64)ceil( ((float)param_info->X1 / (1 << level_X)) - 0.5 * ((highband_flag & DIM_X) >> 0));
subb_info->Y1 = (uint64)ceil( ((float)param_info->Y1 / (1 << level_Y)) - 0.5 * ((highband_flag & DIM_Y) >> 1));
subb_info->Z1 = (uint64)ceil( ((float)param_info->Z1 / (1 << level_Z)) - 0.5 * ((highband_flag & DIM_Z) >> 2));
subb_info->TS1 = (uint16)ceil( ((float)param_info->TS1 / (1 << level_TS)) - 0.5 * ((highband_flag & DIM_TS) >> 3));
subb_info->TS1 = (uint64)ceil( ((float)param_info->TS1 / (1 << level_TS)) - 0.5 * ((highband_flag & DIM_TS) >> 3));
/*--------------------------------------------------------*\
! Evaluate the dynamic range (Rb) of the current subband. !
@ -632,11 +632,11 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r
prec_info->X0 = (uint32)MAX(res_info->X0 , pSizeX * (p_X + (uint32)floor(res_info->X0 / pSizeX)));
prec_info->Y0 = (uint32)MAX(res_info->Y0 , pSizeY * (p_Y + (uint32)floor(res_info->Y0 / pSizeY)));
prec_info->Z0 = (uint32)MAX(res_info->Z0 , pSizeZ * (p_Z + (uint32)floor(res_info->Z0 / pSizeZ)));
prec_info->TS0 = (uint16)MAX(res_info->TS0, pSizeTS * (p_TS + (uint32)floor(res_info->TS0/ pSizeTS)));
prec_info->TS0 = (uint32)MAX(res_info->TS0, pSizeTS * (p_TS + (uint32)floor(res_info->TS0/ pSizeTS)));
prec_info->X1 = (uint32)MIN(res_info->X1 , pSizeX * (p_X + (uint32)floor(res_info->X0 / pSizeX) + 1));
prec_info->Y1 = (uint32)MIN(res_info->Y1 , pSizeY * (p_Y + (uint32)floor(res_info->Y0 / pSizeY) + 1));
prec_info->Z1 = (uint32)MIN(res_info->Z1 , pSizeZ * (p_Z + (uint32)floor(res_info->Z0 / pSizeZ) + 1));
prec_info->TS1 = (uint16)MIN(res_info->TS1, pSizeTS * (p_TS + (uint32)floor(res_info->TS0/ pSizeTS)+ 1));
prec_info->TS1 = (uint32)MIN(res_info->TS1, pSizeTS * (p_TS + (uint32)floor(res_info->TS0/ pSizeTS)+ 1));
if((control->nDecomp - control->decompX) < resolution_level)
{
@ -658,8 +658,8 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r
if((control->nDecomp - control->decompTS) < resolution_level)
{
prec_info->TS0 = (uint16) ceil(((float)prec_info->TS0 / 2) - 0.5 * ((highband_flag & DIM_TS) >> 3));
prec_info->TS1 = (uint16) ceil(((float)prec_info->TS1 / 2) - 0.5 * ((highband_flag & DIM_TS) >> 3));
prec_info->TS0 = (uint32) ceil(((float)prec_info->TS0 / 2) - 0.5 * ((highband_flag & DIM_TS) >> 3));
prec_info->TS1 = (uint32) ceil(((float)prec_info->TS1 / 2) - 0.5 * ((highband_flag & DIM_TS) >> 3));
}
/*--------------------------------------------------------*\
@ -742,8 +742,7 @@ fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const p
\*-----------------------*/
uint64 width, height, depth, dt;
uint64 param_offset;
uint64 x, y, z;
uint16 t;
uint64 x, y, z, t;
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
@ -984,8 +983,7 @@ flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const
uint64 width, height, depth, dt;
uint64 nX, nY, nZ;
uint64 param_offset;
uint64 x, y, z;
uint16 t;
uint64 x, y, z, t;
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
@ -1837,11 +1835,11 @@ create_field(bwc_codec *const field)
res_info->X0 = (uint64)ceil((float)param_info->X0 / (1 << MIN(control->nDecomp -r, control->decompX)));
res_info->Y0 = (uint64)ceil((float)param_info->Y0 / (1 << MIN(control->nDecomp -r, control->decompY)));
res_info->Z0 = (uint64)ceil((float)param_info->Z0 / (1 << MIN(control->nDecomp -r, control->decompZ)));
res_info->TS0 = (uint16)ceil((float)param_info->TS0/ (1 << MIN(control->nDecomp -r, control->decompTS)));
res_info->TS0 = (uint64)ceil((float)param_info->TS0/ (1 << MIN(control->nDecomp -r, control->decompTS)));
res_info->X1 = (uint64)ceil((float)param_info->X1 / (1 << MIN(control->nDecomp -r, control->decompX)));
res_info->Y1 = (uint64)ceil((float)param_info->Y1 / (1 << MIN(control->nDecomp -r, control->decompY)));
res_info->Z1 = (uint64)ceil((float)param_info->Z1 / (1 << MIN(control->nDecomp -r, control->decompZ)));
res_info->TS1 = (uint16)ceil((float)param_info->TS1/ (1 << MIN(control->nDecomp -r, control->decompTS)));
res_info->TS1 = (uint64)ceil((float)param_info->TS1/ (1 << MIN(control->nDecomp -r, control->decompTS)));
/*--------------------------------------------------------*\
! Calculate the number of precincts to cover tile t in pa- !
@ -3587,7 +3585,7 @@ bwc_create_compression(bwc_codec *codec, bwc_stream *stream, char *rate_control)
/*--------------------------------------------------------*\
! Evaluate the size of the main header. !
\*--------------------------------------------------------*/
control->headerSize = 105 + info->nPar * control->nTiles * 2 * PREC_BYTE
control->headerSize = 111 + info->nPar * control->nTiles * 2 * PREC_BYTE
+ control->nLayers * 4;
if(stream->codestream.aux != NULL)

View file

@ -398,9 +398,8 @@ cblkreset_inv(bwc_coder_stripe *const cblk, const uint64 width, const uint64 hei
uint64 i;
uint64 limit;
uint64 cblk_stripe;
uint64 x, y, z;
uint64 x, y, z, t;
int64 idx_u, idx_r, idx_d, idx_l;
uint16 t;
uint8 s;
/*-----------------------*\
@ -533,15 +532,12 @@ cblkcopy_forward(bwc_coder_stripe *const destination, bwc_sample *const source,
\*-----------------------*/
bwc_raw buff, sign_mask;
uint64 bit_mask, limit;
uint64 cblk_width, cblk_height, cblk_depth, cblk_stripe;
uint64 cblk_width, cblk_height, cblk_depth, cblk_dt, cblk_stripe;
uint64 incrX, incrY, incrZ;
uint64 i, x, y, z;
uint64 X0, Y0, Z0;
uint64 X1, Y1, Z1;
uint64 i, x, y, z, t;
uint64 X0, Y0, Z0, TS0;
uint64 X1, Y1, Z1, TS1;
int64 idx_u, idx_r, idx_d, idx_l;
uint16 TS0, TS1;
uint16 cblk_dt;
uint16 t;
uint8 b, Kmax, s;
/*-----------------------*\
@ -775,15 +771,12 @@ cblkcopy_inverse(bwc_coder_stripe *const source, bwc_sample *const destinat
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 cblk_width, cblk_height, cblk_depth, cblk_stripe;
uint64 cblk_width, cblk_height, cblk_depth, cblk_dt, cblk_stripe;
uint64 bit_shift, buff, limit;
uint64 incrX, incrY, incrZ;
uint64 i, x, y, z;
uint64 X0, Y0, Z0;
uint64 X1, Y1, Z1;
uint16 TS0, TS1;
uint16 cblk_dt;
uint16 t;
uint64 i, x, y, z, t;
uint64 X0, Y0, Z0, TS0;
uint64 X1, Y1, Z1, TS1;
uint8 bitplane;
uint8 codingpass;
uint8 s;
@ -2279,7 +2272,7 @@ compute_convex_hull(bwc_encoded_cblk *const encoded_codeblock, double *const mse
! const uint64 width, !
! const uint64 height, !
! const uint64 depth, !
! const uint16 dt) !
! const uint64 dt) !
! !
! !
! DESCRIPTION: !
@ -2312,7 +2305,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
const uint64 width,
const uint64 height,
const uint64 depth,
const uint16 dt)
const uint64 dt)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -2600,7 +2593,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
! const uint64 width, !
! const uint64 height, !
! const uint64 depth, !
! const uint16 dt) !
! const uint64 dt) !
! -------------- !
! !
! DESCRIPTION: !
@ -2633,7 +2626,7 @@ decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
const uint64 width,
const uint64 height,
const uint64 depth,
const uint16 dt)
const uint64 dt)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -2834,14 +2827,13 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 cbSizeX, cbSizeY, cbSizeZ, cbSizeTS;
uint64 width, height, depth;
int64 buff_size;
int64 i, j;
int64 nThreads;
uint16 cbSizeTS;
uint16 slope_max, slope_min;
int16 z;
@ -3137,15 +3129,13 @@ t1_decode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 cbSizeX, cbSizeY, cbSizeZ, cbSizeTS;
uint64 width, height, depth;
int64 buff_size;
int64 i, j;
int64 nThreads;
uint16 cbSizeTS;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/