feat/api #46

Open
Gregor Weiss wants to merge 56 commits from feat/api into main
10 changed files with 283 additions and 302 deletions
Showing only changes of commit 68fcedc9ff - Show all commits

View file

@ -89,7 +89,7 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| || || ||
\************************************************************************************************/ \************************************************************************************************/
uchar assemble_main_header (bwc_codec *const field); uchar assemble_main_header (bwc_codec *const codec);
//==========|==========================|======================|======|======|===================== //==========|==========================|======================|======|======|=====================
uchar codestream_write_aux (bwc_span *const header, uchar codestream_write_aux (bwc_span *const header,
bwc_span *const aux); bwc_span *const aux);

View file

@ -157,13 +157,13 @@
\************************************************************************************************/ \************************************************************************************************/
uchar initialize_gain_lut (); uchar initialize_gain_lut ();
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
bwc_float get_dwt_energy_gain (bwc_codec *const field, bwc_float get_dwt_energy_gain (bwc_codec *const codec,
uchar const highband_flag, uchar const highband_flag,
uint16 const level); uint16 const level);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar forward_wavelet_transform (bwc_codec *const field, uchar forward_wavelet_transform (bwc_codec *const codec,
bwc_parameter *const parameter); bwc_parameter *const parameter);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar inverse_wavelet_transform (bwc_codec *const field, uchar inverse_wavelet_transform (bwc_codec *const codec,
bwc_parameter *const parameter); bwc_parameter *const parameter);
#endif #endif

View file

@ -79,7 +79,7 @@
// TODO: remove // TODO: remove
void bwc_free_data (bwc_stream *const data); void bwc_free_data (bwc_stream *const data);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar create_field (bwc_codec *const codec); uchar create_codec (bwc_codec *const codec);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
bwc_codec* configure_codec (bwc_codec *const codec, bwc_codec* configure_codec (bwc_codec *const codec,
uint64 const nX, uint64 const nX,
@ -100,45 +100,45 @@
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_free_codec (bwc_codec *const codec); void bwc_free_codec (bwc_codec *const codec);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_error_resilience (bwc_codec *const field); void bwc_set_error_resilience (bwc_codec *const codec);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_quant_style (bwc_codec *const field, void set_quant_style (bwc_codec *const codec,
bwc_quant_st const quantization_style); bwc_quant_st const quantization_style);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_quant_step_size (bwc_codec *const field, void set_quant_step_size (bwc_codec *const codec,
double const delta); double const delta);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_progression (bwc_codec *const field, void set_progression (bwc_codec *const codec,
bwc_prog_ord const progression); bwc_prog_ord const progression);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void set_kernels (bwc_codec *const field, void set_kernels (bwc_codec *const codec,
bwc_dwt_filter const KernelX, bwc_dwt_filter const KernelX,
bwc_dwt_filter const KernelY, bwc_dwt_filter const KernelY,
bwc_dwt_filter const KernelZ, bwc_dwt_filter const KernelZ,
bwc_dwt_filter const KernelTS); bwc_dwt_filter const KernelTS);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_decomp (bwc_codec *const field, void bwc_set_decomp (bwc_codec *const codec,
uint8 const decompX, uint8 const decompX,
uint8 const decompY, uint8 const decompY,
uint8 const decompZ, uint8 const decompZ,
uint8 const decompTS); uint8 const decompTS);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_precincts (bwc_codec *const field, void bwc_set_precincts (bwc_codec *const codec,
uint8 const pX, uint8 const pX,
uint8 const pY, uint8 const pY,
uint8 const pZ, uint8 const pZ,
uint8 const pTS); uint8 const pTS);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_codeblocks (bwc_codec *const field, void bwc_set_codeblocks (bwc_codec *const codec,
uint8 const cbX, uint8 const cbX,
uint8 const cbY, uint8 const cbY,
uint8 const cbZ, uint8 const cbZ,
uint8 const cbTS); uint8 const cbTS);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_qm (bwc_codec *const field, void bwc_set_qm (bwc_codec *const codec,
uint8 const Qm); uint8 const Qm);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
void bwc_set_tiles (bwc_codec *const field, void bwc_set_tiles (bwc_codec *const codec,
uint64 const tilesX, uint64 const tilesX,
uint64 const tilesY, uint64 const tilesY,
uint64 const tilesZ, uint64 const tilesZ,
@ -149,7 +149,7 @@
bwc_stream *const data, bwc_stream *const data,
char *const rate_control); char *const rate_control);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
size_t bwc_compress (bwc_codec *const field, size_t bwc_compress (bwc_codec *const codec,
bwc_stream *const data); bwc_stream *const data);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar bwc_create_decompression (bwc_codec *const codec, uchar bwc_create_decompression (bwc_codec *const codec,

View file

@ -156,11 +156,11 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| || || ||
\************************************************************************************************/ \************************************************************************************************/
uchar t1_encode (bwc_codec *const field, uchar t1_encode (bwc_codec *const codec,
bwc_tile *const tile, bwc_tile *const tile,
bwc_parameter *const parameter); bwc_parameter *const parameter);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar t1_decode (bwc_codec *const field, uchar t1_decode (bwc_codec *const codec,
bwc_tile *const tile, bwc_tile *const tile,
bwc_parameter *const parameter); bwc_parameter *const parameter);

View file

@ -76,10 +76,10 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| || || ||
\************************************************************************************************/ \************************************************************************************************/
uchar t2_encode (bwc_codec *const field, uchar t2_encode (bwc_codec *const codec,
bwc_tile *const tile); bwc_tile *const tile);
//==========|==========================|======================|======|=======|==================== //==========|==========================|======================|======|=======|====================
uchar parse_packet (bwc_codec *const field, uchar parse_packet (bwc_codec *const codec,
bwc_tile *const tile, bwc_tile *const tile,
bwc_packet *const packet, bwc_packet *const packet,
uint64 const body_size); uint64 const body_size);

View file

@ -104,7 +104,7 @@ can_read(bitstream *const stream, const uint64 length)
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void codestream_write_header(bitstream *const stream, bwc_codec *const field) ! ! FUNCTION NAME: void codestream_write_header(bitstream *const stream, bwc_codec *const codec) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -116,7 +116,7 @@ can_read(bitstream *const stream, const uint64 length)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! stream bitstream* - Structure used to assemble a bwc bit- ! ! stream bitstream* - Structure used to assemble a bwc bit- !
@ -138,7 +138,7 @@ can_read(bitstream *const stream, const uint64 length)
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static void static void
codestream_write_header(bitstream *const stream, codestream_write_header(bitstream *const stream,
bwc_codec *const field, bwc_codec *const codec,
bwc_stream *const data) bwc_stream *const data)
{ {
/*-----------------------*\ /*-----------------------*\
@ -163,15 +163,15 @@ codestream_write_header(bitstream *const stream,
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(stream); assert(stream);
assert(field); assert(codec);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the global as well as the subband control and info ! ! Save the global as well as the subband control and info !
! structure to temporary variables to make the code more ! ! structure to temporary variables to make the code more !
! readable. ! ! readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
info = &field->info; info = &codec->info;
control = &field->control; control = &codec->control;
aux = data->codestream.aux; aux = data->codestream.aux;
com = data->codestream.com; com = data->codestream.com;
@ -263,21 +263,21 @@ codestream_write_header(bitstream *const stream,
for(p = 0; p < info->nPar; ++p) for(p = 0; p < info->nPar; ++p)
{ {
emit_symbol(stream, *(uint64 *)&field->tile[t]. emit_symbol(stream, *(uint64 *)&codec->tile[t].
parameter[p].info. parameter[p].info.
parameter_min, PREC_BYTE); parameter_min, PREC_BYTE);
emit_symbol(stream, *(uint64 *)&field->tile[t]. emit_symbol(stream, *(uint64 *)&codec->tile[t].
parameter[p].info. parameter[p].info.
parameter_max, PREC_BYTE); parameter_max, PREC_BYTE);
field->tile[t].parameter[p].info.parameter_max = -FLT_MAX; codec->tile[t].parameter[p].info.parameter_max = -FLT_MAX;
field->tile[t].parameter[p].info.parameter_min = FLT_MAX; codec->tile[t].parameter[p].info.parameter_min = FLT_MAX;
} }
} }
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar sequence_packets(bwc_codec *const field, bwc_codec *const field) ! ! FUNCTION NAME: uchar sequence_packets(bwc_codec *const codec, bwc_tile *const tile) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -288,7 +288,7 @@ codestream_write_header(bitstream *const stream,
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
@ -308,7 +308,7 @@ codestream_write_header(bitstream *const stream,
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static uchar static uchar
sequence_packets(bwc_codec *const field, bwc_tile *const tile) sequence_packets(bwc_codec *const codec, bwc_tile *const tile)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -336,8 +336,8 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile)
! sequence structure to temporary variables to make the ! ! sequence structure to temporary variables to make the !
! code more readable. ! ! code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
info = &field->info; info = &codec->info;
packet_sequence = tile->packet_sequence; packet_sequence = tile->packet_sequence;
@ -479,7 +479,7 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile)
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar sequence_packets(bwc_codec *const field, bwc_codec *const field) ! ! FUNCTION NAME: !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -490,16 +490,11 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ !
! decompression stage. !
! !
! tile bwc_tile* - Structure defining a bwc tile. !
! ! ! !
! RETURN VALUE: ! ! RETURN VALUE: !
! ------------- ! ! ------------- !
! Type Description ! ! Type Description !
! ---- ----------- ! ! ---- ----------- !
! uchar - Returns an unsigned char for error handling. !
! ! ! !
! DEVELOPMENT HISTORY: ! ! DEVELOPMENT HISTORY: !
! -------------------- ! ! -------------------- !
@ -510,7 +505,7 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static void static void
assemble_tile(bwc_codec *const field, bwc_tile *const tile, bitstream *const stream) assemble_tile(bwc_codec *const codec, bwc_tile *const tile, bitstream *const stream)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -526,7 +521,7 @@ assemble_tile(bwc_codec *const field, bwc_tile *const tile, bitstream *const str
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
assert(stream); assert(stream);
@ -535,7 +530,7 @@ assemble_tile(bwc_codec *const field, bwc_tile *const tile, bitstream *const str
! sequence structure to temporary variables to make the ! ! sequence structure to temporary variables to make the !
! code more readable. ! ! code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
emit_symbol(stream, SOT, 2); emit_symbol(stream, SOT, 2);
emit_symbol(stream, 14, 2); emit_symbol(stream, 14, 2);
@ -833,7 +828,7 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
control->bitrate[l] = *(float *)&bitrate; control->bitrate[l] = *(float *)&bitrate;
} }
create_field(codec); create_codec(codec);
if(!codec) if(!codec)
{ {
bwc_free_codec(codec); bwc_free_codec(codec);
@ -1029,7 +1024,7 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar sequence_packets(bwc_codec *const field, bwc_codec *const field) ! ! FUNCTION NAME: !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -1040,16 +1035,11 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ !
! decompression stage. !
! !
! tile bwc_tile* - Structure defining a bwc tile. !
! ! ! !
! RETURN VALUE: ! ! RETURN VALUE: !
! ------------- ! ! ------------- !
! Type Description ! ! Type Description !
! ---- ----------- ! ! ---- ----------- !
! uchar - Returns an unsigned char for error handling. !
! ! ! !
! DEVELOPMENT HISTORY: ! ! DEVELOPMENT HISTORY: !
! -------------------- ! ! -------------------- !
@ -1060,7 +1050,7 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static uchar static uchar
parse_tile(bwc_codec *const field, bitstream *const stream) parse_tile(bwc_codec *const codec, bitstream *const stream)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -1080,7 +1070,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream)
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(stream); assert(stream);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -1088,7 +1078,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream)
! sequence structure to temporary variables to make the ! ! sequence structure to temporary variables to make the !
! code more readable. ! ! code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
if(!can_read(stream, 2)) if(!can_read(stream, 2))
{ {
@ -1114,7 +1104,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream)
return 1; return 1;
} }
tile = &field->tile[buf]; tile = &codec->tile[buf];
tile->control.body_size = tile->control.body_size =
body_size = (uint64)get_symbol(stream, 8); body_size = (uint64)get_symbol(stream, 8);
@ -1130,7 +1120,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream)
! Sequence the packets according to the user specified op- ! ! Sequence the packets according to the user specified op- !
! tion. ! ! tion. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(sequence_packets(field, tile)) if(sequence_packets(codec, tile))
{ {
return 1; return 1;
} }
@ -1168,7 +1158,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream)
packet->header.memory = get_access(stream); packet->header.memory = get_access(stream);
if(parse_packet(field, tile, packet, body_size)) if(parse_packet(codec, tile, packet, body_size))
{ {
return 1; return 1;
} }
@ -1210,7 +1200,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static uchar static uchar
parse_body(bwc_codec *const field, bitstream *const stream) parse_body(bwc_codec *const codec, bitstream *const stream)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -1226,7 +1216,7 @@ parse_body(bwc_codec *const field, bitstream *const stream)
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
status = CODESTREAM_OK; status = CODESTREAM_OK;
@ -1244,7 +1234,7 @@ parse_body(bwc_codec *const field, bitstream *const stream)
{ {
case SOT: case SOT:
{ {
if(parse_tile(field, stream)) if(parse_tile(codec, stream))
{ {
status |= CODESTREAM_ERROR; status |= CODESTREAM_ERROR;
} }
@ -1277,7 +1267,7 @@ parse_body(bwc_codec *const field, bitstream *const stream)
{ {
// Invalid Codestream // Invalid Codestream
fprintf(stderr, CSERROR); fprintf(stderr, CSERROR);
bwc_free_codec(field); bwc_free_codec(codec);
status |= CODESTREAM_ERROR; status |= CODESTREAM_ERROR;
break; break;
} }
@ -1287,7 +1277,7 @@ parse_body(bwc_codec *const field, bitstream *const stream)
{ {
// Invalid Codestream // Invalid Codestream
fprintf(stderr, CSERROR); fprintf(stderr, CSERROR);
bwc_free_codec(field); bwc_free_codec(codec);
status |= CODESTREAM_ERROR; status |= CODESTREAM_ERROR;
break; break;
} }
@ -1306,7 +1296,7 @@ parse_body(bwc_codec *const field, bitstream *const stream)
|| || || ||
\************************************************************************************************************/ \************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_span* assemble_codestream(bwc_codec *const field) ! ! FUNCTION NAME: bwc_span* assemble_codestream(bwc_codec *const codec, bwc_stream *const data) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -1317,14 +1307,14 @@ parse_body(bwc_codec *const field, bitstream *const stream)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! RETURN VALUE: ! ! RETURN VALUE: !
! ------------- ! ! ------------- !
! Type Description ! ! Type Description !
! ---- ----------- ! ! ---- ----------- !
! bwc_span* - Packed stream containing the compressed data set. ! ! bwc_span* - Packed stream containing the compressed data set. !
! ! ! !
! DEVELOPMENT HISTORY: ! ! DEVELOPMENT HISTORY: !
! -------------------- ! ! -------------------- !
@ -1335,7 +1325,7 @@ parse_body(bwc_codec *const field, bitstream *const stream)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
size_t size_t
assemble_codestream(bwc_codec *const field, bwc_stream *const data) assemble_codestream(bwc_codec *const codec, bwc_stream *const data)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -1353,7 +1343,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(data); assert(data);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -1362,7 +1352,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
! the final codestream size with the number of header ! ! the final codestream size with the number of header !
! bytes. ! ! bytes. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
control->codestreamSize = control->headerSize + 2; control->codestreamSize = control->headerSize + 2;
@ -1376,13 +1366,13 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
! Save the tile structure in a temporary variable to make ! ! Save the tile structure in a temporary variable to make !
! the code more readable. ! ! the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
tile = &field->tile[i]; tile = &codec->tile[i];
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Sequence the packets according to the user specified op- ! ! Sequence the packets according to the user specified op- !
! tion and iterate the size of the codestream. ! ! tion and iterate the size of the codestream. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(sequence_packets(field, tile)) if(sequence_packets(codec, tile))
{ {
return 0; return 0;
} }
@ -1395,7 +1385,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
! bytes. ! ! bytes. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
stream = init_bitstream(data->out, control->codestreamSize, 'c'); stream = init_bitstream(data->out, control->codestreamSize, 'c');
codestream_write_header(stream, field, data); codestream_write_header(stream, codec, data);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Walk through the tile structure and assemble the packed ! ! Walk through the tile structure and assemble the packed !
@ -1408,9 +1398,9 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
! Save the tile structure in a temporary variable to make ! ! Save the tile structure in a temporary variable to make !
! the code more readable. ! ! the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
tile = &field->tile[i]; tile = &codec->tile[i];
assemble_tile(field, tile, stream); assemble_tile(codec, tile, stream);
} }
emit_symbol(stream, EOC, 2); emit_symbol(stream, EOC, 2);
@ -1422,7 +1412,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar parse_codestream(bwc_codec *const field, bitstream *const stream) ! ! FUNCTION NAME: uchar parse_codestream(bwc_codec *const codec, bitstream *const stream) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -1433,7 +1423,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! stream bitstream* - Structure used to assemble a bwc bit- ! ! stream bitstream* - Structure used to assemble a bwc bit- !

View file

@ -1421,7 +1421,7 @@ initialize_gain_lut()
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_float get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level) ! ! FUNCTION NAME: bwc_float get_dwt_energy_gain(bwc_codec *const codec, uchar highband_flag, uint16 level) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -1434,7 +1434,7 @@ initialize_gain_lut()
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! highband_flag uchar - Defines the subband for which Gb is ! ! highband_flag uchar - Defines the subband for which Gb is !
@ -1459,7 +1459,7 @@ initialize_gain_lut()
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
bwc_float bwc_float
get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level) get_dwt_energy_gain(bwc_codec *const codec, uchar highband_flag, uint16 level)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -1480,15 +1480,15 @@ get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level)
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(level <= field->control.nDecomp + 1); assert(level <= codec->control.nDecomp + 1);
assert(highband_flag <= DIM_ALL); assert(highband_flag <= DIM_ALL);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the global control structure to a temporary varia- ! ! Save the global control structure to a temporary varia- !
! ble to make the code more readable. ! ! ble to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Evaluate the number of decompositions in each temporal & ! ! Evaluate the number of decompositions in each temporal & !
@ -1576,7 +1576,7 @@ get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level)
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar forward_discrete_wavelet_transform(bwc_codec *const field, ! ! FUNCTION NAME: uchar forward_discrete_wavelet_transform(bwc_codec *const codec, !
! -------------- bwc_parameter *const parameter) ! ! -------------- bwc_parameter *const parameter) !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -1594,7 +1594,7 @@ get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! parameter bwc_parameter* - Structure defining a bwc parameter. ! ! parameter bwc_parameter* - Structure defining a bwc parameter. !
@ -1614,7 +1614,7 @@ get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
uchar uchar
forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter) forward_wavelet_transform(bwc_codec *const codec, bwc_parameter *const parameter)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -1646,7 +1646,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(parameter); assert(parameter);
/*-----------------------*\ /*-----------------------*\
@ -1664,7 +1664,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
! Save the global control and parameter info structure to ! ! Save the global control and parameter info structure to !
! temporary variables to make the code more readable. ! ! temporary variables to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
param_info = &parameter->info; param_info = &parameter->info;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
@ -2111,7 +2111,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar inverse_discrete_wavelet_transform(bwc_codec *const field, ! ! FUNCTION NAME: uchar inverse_discrete_wavelet_transform(bwc_codec *const codec, !
! -------------- bwc_parameter *const parameter) ! ! -------------- bwc_parameter *const parameter) !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -2129,7 +2129,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! parameter bwc_parameter* - Structure defining a bwc parameter. ! ! parameter bwc_parameter* - Structure defining a bwc parameter. !
@ -2149,7 +2149,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
uchar uchar
inverse_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter) inverse_wavelet_transform(bwc_codec *const codec, bwc_parameter *const parameter)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -2181,7 +2181,7 @@ inverse_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(parameter); assert(parameter);
/*-----------------------*\ /*-----------------------*\
@ -2199,7 +2199,7 @@ inverse_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter
! Save the global control and parameter info structure to ! ! Save the global control and parameter info structure to !
! temporary variables to make the code more readable. ! ! temporary variables to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
param_info = &parameter->info; param_info = &parameter->info;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\

File diff suppressed because it is too large Load diff

View file

@ -2267,7 +2267,7 @@ compute_convex_hull(bwc_encoded_cblk *const encoded_codeblock, double *const mse
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_encoded_cblk* encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, ! ! FUNCTION NAME: void encode_codeblock(bwc_codec *const codec, bwc_cblk_access *const access, !
! -------------- bwc_coder_stripe *const codeblock, ! ! -------------- bwc_coder_stripe *const codeblock, !
! const uint64 width, ! ! const uint64 width, !
! const uint64 height, ! ! const uint64 height, !
@ -2300,7 +2300,7 @@ compute_convex_hull(bwc_encoded_cblk *const encoded_codeblock, double *const mse
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static void static void
encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, encode_codeblock(bwc_codec *const codec, bwc_cblk_access *const access,
bwc_coder_stripe *const codeblock, bwc_coder_stripe *const codeblock,
const uint64 width, const uint64 width,
const uint64 height, const uint64 height,
@ -2333,7 +2333,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(access); assert(access);
assert(codeblock); assert(codeblock);
assert(access->subband->control.highband_flag <= 15); assert(access->subband->control.highband_flag <= 15);
@ -2352,7 +2352,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
! info and encoded block structure to temporary variables ! ! info and encoded block structure to temporary variables !
! to make the code more readable. ! ! to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
subb_ctrl = &access->subband->control; subb_ctrl = &access->subband->control;
subb_inf = &access->subband->info; subb_inf = &access->subband->info;
@ -2588,7 +2588,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_encoded_cblk* encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, ! ! FUNCTION NAME: void decode_codeblock(bwc_codec *const codec, bwc_cblk_access *const access, !
! bwc_coder_stripe *const codeblock, ! ! bwc_coder_stripe *const codeblock, !
! const uint64 width, ! ! const uint64 width, !
! const uint64 height, ! ! const uint64 height, !
@ -2621,7 +2621,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static void static void
decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, decode_codeblock(bwc_codec *const codec, bwc_cblk_access *const access,
bwc_coder_stripe *const codeblock, bwc_coder_stripe *const codeblock,
const uint64 width, const uint64 width,
const uint64 height, const uint64 height,
@ -2645,7 +2645,7 @@ decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(access); assert(access);
assert(codeblock); assert(codeblock);
assert(access->subband->control.highband_flag <= 15); assert(access->subband->control.highband_flag <= 15);
@ -2664,7 +2664,7 @@ decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
! structure to temporary variables to make the code more ! ! structure to temporary variables to make the code more !
! readable. ! ! readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
subb_ctrl = &access->subband->control; subb_ctrl = &access->subband->control;
@ -2821,7 +2821,7 @@ decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access,
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
uchar uchar
t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const parameter) t1_encode(bwc_codec *const codec, bwc_tile *const tile, bwc_parameter *const parameter)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -2849,7 +2849,7 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
assert(parameter); assert(parameter);
@ -2857,7 +2857,7 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
! Save the global control structure to a temporary varia- ! ! Save the global control structure to a temporary varia- !
! ble to make the code more readable. ! ! ble to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the minimum and maximum slope values for the cur- ! ! Save the minimum and maximum slope values for the cur- !
@ -3032,7 +3032,7 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
! truncation points (L) and possible slope values (S) in ! ! truncation points (L) and possible slope values (S) in !
! the bwc_encoded_cblk structure. ! ! the bwc_encoded_cblk structure. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
encode_codeblock(field, &parameter->access[c], working_buffer, encode_codeblock(codec, &parameter->access[c], working_buffer,
cbSizeX, cbSizeY, cbSizeX, cbSizeY,
cbSizeZ, cbSizeTS); cbSizeZ, cbSizeTS);
@ -3123,7 +3123,7 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
uchar uchar
t1_decode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const parameter) t1_decode(bwc_codec *const codec, bwc_tile *const tile, bwc_parameter *const parameter)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -3149,7 +3149,7 @@ t1_decode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
assert(parameter); assert(parameter);
@ -3157,7 +3157,7 @@ t1_decode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
! Save the global control structure to a temporary varia- ! ! Save the global control structure to a temporary varia- !
! ble to make the code more readable. ! ! ble to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Evaluate the width, height and depth of the current ! ! Evaluate the width, height and depth of the current !
@ -3322,7 +3322,7 @@ t1_decode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par
if(codeblock->encoded_block->Z > 0) if(codeblock->encoded_block->Z > 0)
{ {
decode_codeblock(field, &parameter->access[c], working_buffer, decode_codeblock(codec, &parameter->access[c], working_buffer,
cbSizeX, cbSizeY, cbSizeX, cbSizeY,
cbSizeZ, cbSizeTS); cbSizeZ, cbSizeTS);
} }

View file

@ -312,7 +312,7 @@ encode_length(bitstream *const header, bwc_codeblock *const codeblock,
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void create_quality_layers(bwc_codec *const field, bwc_tile *const tile) ! ! FUNCTION NAME: !
! -------------- ! ! -------------- !
! ! ! !
! ! ! !
@ -385,11 +385,10 @@ decode_length(bitstream *const header, bwc_codeblock *const codeblock, int8 cons
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: int64 create_packet(bwc_codec *const field, bwc_tile *const tile, ! ! FUNCTION NAME: int64 create_packet(bwc_tile *const tile, bwc_resolution *const resolution, !
! -------------- bwc_resolution *const resolution, ! ! -------------- uint32 const prec_idx, !
! uint32 const prec_idx, ! ! int8 const q_layer, !
! int8 const q_layer, ! ! uchar const est) !
! uchar const est) !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
! ------------ ! ! ------------ !
@ -403,9 +402,6 @@ decode_length(bitstream *const header, bwc_codeblock *const codeblock, int8 cons
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ !
! decompression stage. !
! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
! ! ! !
! resolution bwc_resolution* - Structure defining a bwc resolution ! ! resolution bwc_resolution* - Structure defining a bwc resolution !
@ -435,11 +431,10 @@ decode_length(bitstream *const header, bwc_codeblock *const codeblock, int8 cons
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static int32 static int32
create_packet(bwc_codec *const field, bwc_tile *const tile, create_packet(bwc_tile *const tile, bwc_resolution *const resolution,
bwc_resolution *const resolution, uint32 const prec_idx,
uint32 const prec_idx, int16 const q_layer,
int16 const q_layer, uchar const est)
uchar const est)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -463,7 +458,6 @@ create_packet(bwc_codec *const field, bwc_tile *const tile,
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field);
assert(tile); assert(tile);
assert(resolution); assert(resolution);
@ -717,7 +711,7 @@ create_packet(bwc_codec *const field, bwc_tile *const tile,
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar create_packets(bwc_codec *const field, bwc_tile *const tile) ! ! FUNCTION NAME: uchar create_packets(bwc_codec *const codec, bwc_tile *const tile) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -734,7 +728,7 @@ create_packet(bwc_codec *const field, bwc_tile *const tile,
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
@ -754,7 +748,7 @@ create_packet(bwc_codec *const field, bwc_tile *const tile,
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static uchar static uchar
create_packets(bwc_codec *const field, bwc_tile *const tile) create_packets(bwc_codec *const codec, bwc_tile *const tile)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -775,15 +769,15 @@ create_packets(bwc_codec *const field, bwc_tile *const tile)
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the global control and info structure to temporary ! ! Save the global control and info structure to temporary !
! variables to make the code more readable. ! ! variables to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
info = &field->info; info = &codec->info;
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Iterate overall quality layers for every precinct in all ! ! Iterate overall quality layers for every precinct in all !
@ -810,7 +804,7 @@ create_packets(bwc_codec *const field, bwc_tile *const tile)
{ {
for(l = 0; l < control->nLayers; ++l) for(l = 0; l < control->nLayers; ++l)
{ {
if(create_packet(field, tile, resolution, p, l, 0) < 0) if(create_packet(tile, resolution, p, l, 0) < 0)
{ {
// memory allocation error // memory allocation error
return 1; return 1;
@ -856,7 +850,7 @@ create_packets(bwc_codec *const field, bwc_tile *const tile)
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: int64 create_quality_layer(bwc_codec *const field, bwc_tile *const tile, ! ! FUNCTION NAME: int64 create_quality_layer(bwc_codec *const codec, bwc_tile *const tile, !
! -------------- uint16 const threshold, ! ! -------------- uint16 const threshold, !
! int16 const q_layer, ! ! int16 const q_layer, !
! uchar const est) ! ! uchar const est) !
@ -871,7 +865,7 @@ create_packets(bwc_codec *const field, bwc_tile *const tile)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
@ -899,7 +893,7 @@ create_packets(bwc_codec *const field, bwc_tile *const tile)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static int64 static int64
create_quality_layer(bwc_codec *const field, bwc_tile *const tile, create_quality_layer(bwc_codec *const codec, bwc_tile *const tile,
uint16 const threshold, uint16 const threshold,
int16 const q_layer, int16 const q_layer,
uchar const est) uchar const est)
@ -927,15 +921,15 @@ create_quality_layer(bwc_codec *const field, bwc_tile *const tile,
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the global control and info structure to temporary ! ! Save the global control and info structure to temporary !
! variables to make the code more readable. ! ! variables to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
info = &field->info; info = &codec->info;
for(j = 0, estimated_ql_size = 0; j < info->nPar; ++j) for(j = 0, estimated_ql_size = 0; j < info->nPar; ++j)
{ {
@ -1067,7 +1061,7 @@ create_quality_layer(bwc_codec *const field, bwc_tile *const tile,
for(p = 0; p < resolution->control.number_of_precincts; ++p) for(p = 0; p < resolution->control.number_of_precincts; ++p)
{ {
estimated_ph_size = create_packet(field, tile, resolution, p, q_layer, est + 1); estimated_ph_size = create_packet(tile, resolution, p, q_layer, est + 1);
if(estimated_ph_size < 0) if(estimated_ph_size < 0)
{ {
@ -1086,7 +1080,7 @@ create_quality_layer(bwc_codec *const field, bwc_tile *const tile,
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void create_quality_layers(bwc_codec *const field, bwc_tile *const tile) ! ! FUNCTION NAME: void create_quality_layers(bwc_codec *const codec, bwc_tile *const tile) !
! -------------- ! ! -------------- !
! ! ! !
! ! ! !
@ -1098,7 +1092,7 @@ create_quality_layer(bwc_codec *const field, bwc_tile *const tile,
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
@ -1118,7 +1112,7 @@ create_quality_layer(bwc_codec *const field, bwc_tile *const tile,
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
static uchar static uchar
create_quality_layers(bwc_codec *const field, bwc_tile *const tile) create_quality_layers(bwc_codec *const codec, bwc_tile *const tile)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE INT VARIABLES: ! ! DEFINE INT VARIABLES: !
@ -1142,15 +1136,15 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile)
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Save the global and tile control and info structure to ! ! Save the global and tile control and info structure to !
! temporary variables to make the code more readable. ! ! temporary variables to make the code more readable. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
control = &field->control; control = &codec->control;
info = &field->info; info = &codec->info;
tile_control = &tile->control; tile_control = &tile->control;
tile_info = &tile->info; tile_info = &tile->info;
@ -1200,7 +1194,7 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile)
{ {
slope = (slope_max + slope_min) >> 1; slope = (slope_max + slope_min) >> 1;
estimated_ql_size = create_quality_layer(field, tile, slope, l, 1); estimated_ql_size = create_quality_layer(codec, tile, slope, l, 1);
if(estimated_ql_size >= 0) if(estimated_ql_size >= 0)
{ {
@ -1245,7 +1239,7 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile)
slope = 0; slope = 0;
} }
estimated_ql_size = create_quality_layer(field, tile, slope, l, 0); estimated_ql_size = create_quality_layer(codec, tile, slope, l, 0);
if(estimated_ql_size >= 0) if(estimated_ql_size >= 0)
{ {
@ -1266,7 +1260,7 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile)
|| || || ||
\************************************************************************************************************/ \************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar t2_encode(bwc_codec *const field, bwc_tile *const tile) ! ! FUNCTION NAME: uchar t2_encode(bwc_codec *const codec, bwc_tile *const tile) !
! -------------- ! ! -------------- !
! ! ! !
! DESCRIPTION: ! ! DESCRIPTION: !
@ -1280,7 +1274,7 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
@ -1300,19 +1294,19 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
uchar uchar
t2_encode(bwc_codec *const field, bwc_tile *const tile) t2_encode(bwc_codec *const codec, bwc_tile *const tile)
{ {
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! Create the quality layers according to the bitrate val- ! ! Create the quality layers according to the bitrate val- !
! ues provided by the user. ! ! ues provided by the user. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(create_quality_layers(field, tile)) if(create_quality_layers(codec, tile))
{ {
return 1; return 1;
} }
@ -1321,7 +1315,7 @@ t2_encode(bwc_codec *const field, bwc_tile *const tile)
! Create the data packets according to the quality layers ! ! Create the data packets according to the quality layers !
! evaluated in the previous step. ! ! evaluated in the previous step. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(create_packets(field, tile)) if(create_packets(codec, tile))
{ {
return 1; return 1;
} }
@ -1330,7 +1324,7 @@ t2_encode(bwc_codec *const field, bwc_tile *const tile)
} }
/*----------------------------------------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar parse_packet(bwc_codec *const field, bwc_tile *const tile, ! ! FUNCTION NAME: uchar parse_packet(bwc_codec *const codec, bwc_tile *const tile, !
! -------------- bwc_packet *const packet, ! ! -------------- bwc_packet *const packet, !
! uint64 const body_size) ! ! uint64 const body_size) !
! ! ! !
@ -1343,7 +1337,7 @@ t2_encode(bwc_codec *const field, bwc_tile *const tile)
! ----------- ! ! ----------- !
! Variable Type Description ! ! Variable Type Description !
! -------- ---- ----------- ! ! -------- ---- ----------- !
! field bwc_codec* - Structure defining the compression/ ! ! codec bwc_codec* - Structure defining the compression/ !
! decompression stage. ! ! decompression stage. !
! ! ! !
! tile bwc_tile* - Structure defining a bwc tile. ! ! tile bwc_tile* - Structure defining a bwc tile. !
@ -1367,7 +1361,7 @@ t2_encode(bwc_codec *const field, bwc_tile *const tile)
! ! ! !
\*----------------------------------------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------------------------------------*/
uchar uchar
parse_packet(bwc_codec *const field, bwc_tile *const tile, parse_packet(bwc_codec *const codec, bwc_tile *const tile,
bwc_packet *const packet, bwc_packet *const packet,
uint64 const body_size) uint64 const body_size)
{ {
@ -1393,7 +1387,7 @@ parse_packet(bwc_codec *const field, bwc_tile *const tile,
/*-----------------------*\ /*-----------------------*\
! DEFINE ASSERTIONS: ! ! DEFINE ASSERTIONS: !
\*-----------------------*/ \*-----------------------*/
assert(field); assert(codec);
assert(tile); assert(tile);
assert(packet); assert(packet);
@ -1583,7 +1577,7 @@ parse_packet(bwc_codec *const field, bwc_tile *const tile,
! If the error resilience mode is active for the current ! ! If the error resilience mode is active for the current !
! codestream... ! ! codestream... !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
if(field->control.error_resilience) if(codec->control.error_resilience)
{ {
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
! check if the next symbol corresponds to the end of pack- ! ! check if the next symbol corresponds to the end of pack- !