feat/api #46

Open
Gregor Weiss wants to merge 56 commits from feat/api into main
4 changed files with 18 additions and 19 deletions
Showing only changes of commit e970a0d892 - Show all commits

View file

@ -85,14 +85,14 @@
uint64 const nX, uint64 const nX,
uint64 const nY, uint64 const nY,
uint64 const nZ, uint64 const nZ,
uint16 const nTS, uint64 const nTS,
uint8 const nPar, uint8 const nPar,
bwc_precision const prec); bwc_precision const prec);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
bwc_codec* bwc_alloc_coder (uint64 const nX, bwc_codec* bwc_alloc_coder (uint64 const nX,
uint64 const nY, uint64 const nY,
uint64 const nZ, uint64 const nZ,
uint16 const nTS, uint64 const nTS,
uint8 const nPar, uint8 const nPar,
bwc_precision const prec); bwc_precision const prec);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================

View file

@ -97,7 +97,7 @@ def initialize_data(data, nX, nY, nZ, nTS, nPar, file_extension):
ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_uint16, ctypes.c_uint64,
ctypes.c_uint8, ctypes.c_uint8,
ctypes.c_char_p] ctypes.c_char_p]
return ctypes.c_void_p(fun(data, nX, nY, nZ, nTS, nPar, file_extension.encode('utf-8'))) return ctypes.c_void_p(fun(data, nX, nY, nZ, nTS, nPar, file_extension.encode('utf-8')))

View file

@ -188,7 +188,7 @@ codestream_write_header(bitstream *const stream,
emit_symbol(stream, info->nX, 8); emit_symbol(stream, info->nX, 8);
emit_symbol(stream, info->nY, 8); emit_symbol(stream, info->nY, 8);
emit_symbol(stream, info->nZ, 8); emit_symbol(stream, info->nZ, 8);
emit_symbol(stream, info->nTS, 2); emit_symbol(stream, info->nTS, 8);
emit_symbol(stream, info->nPar, 1); emit_symbol(stream, info->nPar, 1);
emit_symbol(stream, (uint8)info->data_prec, 1); emit_symbol(stream, (uint8)info->data_prec, 1);
emit_symbol(stream, (uint8)info->codec_prec, 1); emit_symbol(stream, (uint8)info->codec_prec, 1);
@ -700,7 +700,7 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
nX = get_symbol(stream, 8); nX = get_symbol(stream, 8);
nY = get_symbol(stream, 8); nY = get_symbol(stream, 8);
nZ = get_symbol(stream, 8); nZ = get_symbol(stream, 8);
nTS = (uint16)get_symbol(stream, 2); nTS = get_symbol(stream, 8);
nPar = (uint8)get_symbol(stream, 1); nPar = (uint8)get_symbol(stream, 1);
data_prec = (bwc_precision)get_symbol(stream, 1); data_prec = (bwc_precision)get_symbol(stream, 1);
codec_prec = (bwc_precision)get_symbol(stream, 1); codec_prec = (bwc_precision)get_symbol(stream, 1);

View file

@ -1742,11 +1742,11 @@ create_field(bwc_codec *const field)
tile_info->X0 = (uint64)MAX(0, x * control->tileSizeX); tile_info->X0 = (uint64)MAX(0, x * control->tileSizeX);
tile_info->Y0 = (uint64)MAX(0, y * control->tileSizeY); tile_info->Y0 = (uint64)MAX(0, y * control->tileSizeY);
tile_info->Z0 = (uint64)MAX(0, z * control->tileSizeZ); tile_info->Z0 = (uint64)MAX(0, z * control->tileSizeZ);
tile_info->TS0 = (uint16)MAX(0, t * control->tileSizeTS); tile_info->TS0 = (uint64)MAX(0, t * control->tileSizeTS);
tile_info->X1 = (uint64)MIN(info->nX , (x + 1) * control->tileSizeX); tile_info->X1 = (uint64)MIN(info->nX , (x + 1) * control->tileSizeX);
tile_info->Y1 = (uint64)MIN(info->nY , (y + 1) * control->tileSizeY); tile_info->Y1 = (uint64)MIN(info->nY , (y + 1) * control->tileSizeY);
tile_info->Z1 = (uint64)MIN(info->nZ , (z + 1) * control->tileSizeZ); tile_info->Z1 = (uint64)MIN(info->nZ , (z + 1) * control->tileSizeZ);
tile_info->TS1 = (uint16)MIN(info->nTS, (t + 1) * control->tileSizeTS); tile_info->TS1 = (uint64)MIN(info->nTS, (t + 1) * control->tileSizeTS);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Initialize the tile header size. ! ! Initialize the tile header size. !
@ -2150,7 +2150,7 @@ bwc_free_codec(bwc_codec *const codec)
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
bwc_codec* bwc_codec*
configure_codec(bwc_codec *const codec, uint64 const nX, uint64 const nY, uint64 const nZ, configure_codec(bwc_codec *const codec, uint64 const nX, uint64 const nY, uint64 const nZ,
uint16 const nTS, uint8 const nPar, bwc_precision const prec) uint64 const nTS, uint8 const nPar, bwc_precision const prec)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -2321,7 +2321,7 @@ configure_codec(bwc_codec *const codec, uint64 const nX, uint64 const nY, uint64
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
bwc_codec* bwc_codec*
bwc_alloc_coder(uint64 const nX, uint64 const nY, uint64 const nZ, uint16 const nTS, bwc_alloc_coder(uint64 const nX, uint64 const nY, uint64 const nZ, uint64 const nTS,
uint8 const nPar, bwc_precision const prec) uint8 const nPar, bwc_precision const prec)
{ {
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3230,13 +3230,12 @@ bwc_set_qm(bwc_codec *const field, uint8 Qm)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
void void
bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tilesZ, uint16 tilesTS, bwc_tile_instr instr) bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tilesZ, uint64 tilesTS, bwc_tile_instr instr)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
\*-----------------------*/ \*-----------------------*/
uint64 num_tiles_X, num_tiles_Y, num_tiles_Z; uint64 num_tiles_X, num_tiles_Y, num_tiles_Z, num_tiles_TS;
uint16 num_tiles_TS;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -3304,7 +3303,7 @@ bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
num_tiles_X = (uint64)ceil(((float)info->nX / control->tileSizeX)); num_tiles_X = (uint64)ceil(((float)info->nX / control->tileSizeX));
num_tiles_Y = (uint64)ceil(((float)info->nY / control->tileSizeY)); num_tiles_Y = (uint64)ceil(((float)info->nY / control->tileSizeY));
num_tiles_Z = (uint64)ceil(((float)info->nZ / control->tileSizeZ)); num_tiles_Z = (uint64)ceil(((float)info->nZ / control->tileSizeZ));
num_tiles_TS = (uint16)ceil(((float)info->nTS/ control->tileSizeTS)); num_tiles_TS = (uint64)ceil(((float)info->nTS/ control->tileSizeTS));
control->nTiles = num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS; control->nTiles = num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -3366,7 +3365,7 @@ bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
control->tileSizeX = (info->nX >> 1) ? (tilesX ? (uint64)ceil(((float)info->nX / tilesX)) : info->nX) : info->nX; control->tileSizeX = (info->nX >> 1) ? (tilesX ? (uint64)ceil(((float)info->nX / tilesX)) : info->nX) : info->nX;
control->tileSizeY = (info->nY >> 1) ? (tilesY ? (uint64)ceil(((float)info->nY / tilesY)) : info->nY) : info->nY; control->tileSizeY = (info->nY >> 1) ? (tilesY ? (uint64)ceil(((float)info->nY / tilesY)) : info->nY) : info->nY;
control->tileSizeZ = (info->nZ >> 1) ? (tilesZ ? (uint64)ceil(((float)info->nZ / tilesZ)) : info->nZ) : info->nZ; control->tileSizeZ = (info->nZ >> 1) ? (tilesZ ? (uint64)ceil(((float)info->nZ / tilesZ)) : info->nZ) : info->nZ;
control->tileSizeTS = (info->nTS >> 1) ? (tilesTS ? (uint16)ceil(((float)info->nTS/ tilesTS)) : info->nTS) : info->nTS; control->tileSizeTS = (info->nTS >> 1) ? (tilesTS ? (uint64)ceil(((float)info->nTS/ tilesTS)) : info->nTS) : info->nTS;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Check if the tile sizes have valid values. ! ! Check if the tile sizes have valid values. !
@ -3406,7 +3405,7 @@ bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tiles
num_tiles_X = (uint64)ceil(((float)info->nX / control->tileSizeX)); num_tiles_X = (uint64)ceil(((float)info->nX / control->tileSizeX));
num_tiles_Y = (uint64)ceil(((float)info->nY / control->tileSizeY)); num_tiles_Y = (uint64)ceil(((float)info->nY / control->tileSizeY));
num_tiles_Z = (uint64)ceil(((float)info->nZ / control->tileSizeZ)); num_tiles_Z = (uint64)ceil(((float)info->nZ / control->tileSizeZ));
num_tiles_TS = (uint16)ceil(((float)info->nTS/ control->tileSizeTS)); num_tiles_TS = (uint64)ceil(((float)info->nTS/ control->tileSizeTS));
control->nTiles = num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS; control->nTiles = num_tiles_X * num_tiles_Y * num_tiles_Z * num_tiles_TS;
} }
@ -3588,8 +3587,8 @@ bwc_create_compression(bwc_codec *codec, bwc_stream *stream, char *rate_control)
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Evaluate the size of the main header. ! ! Evaluate the size of the main header. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control->headerSize = 99 + info->nPar * control->nTiles * 2 * PREC_BYTE control->headerSize = 105 + info->nPar * control->nTiles * 2 * PREC_BYTE
+ control->nLayers * 4; + control->nLayers * 4;
if(stream->codestream.aux != NULL) if(stream->codestream.aux != NULL)
{ {