diff --git a/include/library/private/codestream.h b/include/library/private/codestream.h index e7f54fc..0445b59 100755 --- a/include/library/private/codestream.h +++ b/include/library/private/codestream.h @@ -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, bwc_span *const aux); diff --git a/include/library/private/dwt.h b/include/library/private/dwt.h index fa08858..1b17a6f 100755 --- a/include/library/private/dwt.h +++ b/include/library/private/dwt.h @@ -157,13 +157,13 @@ \************************************************************************************************/ 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, uint16 const level); //==========|==========================|======================|======|=======|==================== - uchar forward_wavelet_transform (bwc_codec *const field, + uchar forward_wavelet_transform (bwc_codec *const codec, bwc_parameter *const parameter); //==========|==========================|======================|======|=======|==================== - uchar inverse_wavelet_transform (bwc_codec *const field, + uchar inverse_wavelet_transform (bwc_codec *const codec, bwc_parameter *const parameter); #endif \ No newline at end of file diff --git a/include/library/private/libbwc.h b/include/library/private/libbwc.h index e84218b..c2b003d 100755 --- a/include/library/private/libbwc.h +++ b/include/library/private/libbwc.h @@ -79,7 +79,7 @@ // TODO: remove 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, uint64 const nX, @@ -100,45 +100,45 @@ //==========|==========================|======================|======|=======|==================== 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); //==========|==========================|======================|======|=======|==================== - void set_quant_step_size (bwc_codec *const field, + void set_quant_step_size (bwc_codec *const codec, double const delta); //==========|==========================|======================|======|=======|==================== - void set_progression (bwc_codec *const field, + void set_progression (bwc_codec *const codec, 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 KernelY, bwc_dwt_filter const KernelZ, 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 decompY, uint8 const decompZ, uint8 const decompTS); //==========|==========================|======================|======|=======|==================== - void bwc_set_precincts (bwc_codec *const field, + void bwc_set_precincts (bwc_codec *const codec, uint8 const pX, uint8 const pY, uint8 const pZ, uint8 const pTS); //==========|==========================|======================|======|=======|==================== - void bwc_set_codeblocks (bwc_codec *const field, + void bwc_set_codeblocks (bwc_codec *const codec, uint8 const cbX, uint8 const cbY, uint8 const cbZ, uint8 const cbTS); //==========|==========================|======================|======|=======|==================== - void bwc_set_qm (bwc_codec *const field, + void bwc_set_qm (bwc_codec *const codec, uint8 const Qm); //==========|==========================|======================|======|=======|==================== - void bwc_set_tiles (bwc_codec *const field, + void bwc_set_tiles (bwc_codec *const codec, uint64 const tilesX, uint64 const tilesY, uint64 const tilesZ, @@ -149,7 +149,7 @@ bwc_stream *const data, char *const rate_control); //==========|==========================|======================|======|=======|==================== - size_t bwc_compress (bwc_codec *const field, + size_t bwc_compress (bwc_codec *const codec, bwc_stream *const data); //==========|==========================|======================|======|=======|==================== uchar bwc_create_decompression (bwc_codec *const codec, diff --git a/include/library/private/tier1.h b/include/library/private/tier1.h index 7f0e19c..14546cc 100755 --- a/include/library/private/tier1.h +++ b/include/library/private/tier1.h @@ -156,11 +156,11 @@ || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || || || \************************************************************************************************/ - uchar t1_encode (bwc_codec *const field, + uchar t1_encode (bwc_codec *const codec, bwc_tile *const tile, bwc_parameter *const parameter); //==========|==========================|======================|======|=======|==================== - uchar t1_decode (bwc_codec *const field, + uchar t1_decode (bwc_codec *const codec, bwc_tile *const tile, bwc_parameter *const parameter); diff --git a/include/library/private/tier2.h b/include/library/private/tier2.h index 074e49d..d55cb65 100755 --- a/include/library/private/tier2.h +++ b/include/library/private/tier2.h @@ -76,10 +76,10 @@ || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || || || \************************************************************************************************/ - uchar t2_encode (bwc_codec *const field, + uchar t2_encode (bwc_codec *const codec, bwc_tile *const tile); //==========|==========================|======================|======|=======|==================== - uchar parse_packet (bwc_codec *const field, + uchar parse_packet (bwc_codec *const codec, bwc_tile *const tile, bwc_packet *const packet, uint64 const body_size); diff --git a/src/library/codestream.c b/src/library/codestream.c index a1468ec..3c0d8d3 100755 --- a/src/library/codestream.c +++ b/src/library/codestream.c @@ -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: ! @@ -116,7 +116,7 @@ can_read(bitstream *const stream, const uint64 length) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! stream bitstream* - Structure used to assemble a bwc bit- ! @@ -138,7 +138,7 @@ can_read(bitstream *const stream, const uint64 length) \*----------------------------------------------------------------------------------------------------------*/ static void codestream_write_header(bitstream *const stream, - bwc_codec *const field, + bwc_codec *const codec, bwc_stream *const data) { /*-----------------------*\ @@ -163,15 +163,15 @@ codestream_write_header(bitstream *const stream, ! DEFINE ASSERTIONS: ! \*-----------------------*/ assert(stream); - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global as well as the subband control and info ! ! structure to temporary variables to make the code more ! ! readable. ! \*--------------------------------------------------------*/ - info = &field->info; - control = &field->control; + info = &codec->info; + control = &codec->control; aux = data->codestream.aux; com = data->codestream.com; @@ -263,21 +263,21 @@ codestream_write_header(bitstream *const stream, 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_min, PREC_BYTE); - emit_symbol(stream, *(uint64 *)&field->tile[t]. + emit_symbol(stream, *(uint64 *)&codec->tile[t]. parameter[p].info. parameter_max, PREC_BYTE); - field->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_max = -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: ! @@ -288,7 +288,7 @@ codestream_write_header(bitstream *const stream, ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -308,7 +308,7 @@ codestream_write_header(bitstream *const stream, ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -336,8 +336,8 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile) ! sequence structure to temporary variables to make the ! ! code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; 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: ! @@ -490,16 +490,11 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! -! decompression stage. ! -! ! -! tile bwc_tile* - Structure defining a bwc tile. ! ! ! ! RETURN VALUE: ! ! ------------- ! ! Type Description ! ! ---- ----------- ! -! uchar - Returns an unsigned char for error handling. ! ! ! ! DEVELOPMENT HISTORY: ! ! -------------------- ! @@ -510,7 +505,7 @@ sequence_packets(bwc_codec *const field, bwc_tile *const tile) ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -526,7 +521,7 @@ assemble_tile(bwc_codec *const field, bwc_tile *const tile, bitstream *const str /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); 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 ! ! code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; emit_symbol(stream, SOT, 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; } - create_field(codec); + create_codec(codec); if(!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: ! @@ -1040,16 +1035,11 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! -! decompression stage. ! -! ! -! tile bwc_tile* - Structure defining a bwc tile. ! ! ! ! RETURN VALUE: ! ! ------------- ! ! Type Description ! ! ---- ----------- ! -! uchar - Returns an unsigned char for error handling. ! ! ! ! DEVELOPMENT HISTORY: ! ! -------------------- ! @@ -1060,7 +1050,7 @@ parse_main_header(bwc_codec *const codec, bwc_stream *const data, bitstream *con ! ! \*----------------------------------------------------------------------------------------------------------*/ static uchar -parse_tile(bwc_codec *const field, bitstream *const stream) +parse_tile(bwc_codec *const codec, bitstream *const stream) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -1080,7 +1070,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(stream); /*--------------------------------------------------------*\ @@ -1088,7 +1078,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream) ! sequence structure to temporary variables to make the ! ! code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; if(!can_read(stream, 2)) { @@ -1114,7 +1104,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream) return 1; } - tile = &field->tile[buf]; + tile = &codec->tile[buf]; tile->control.body_size = 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- ! ! tion. ! \*--------------------------------------------------------*/ - if(sequence_packets(field, tile)) + if(sequence_packets(codec, tile)) { return 1; } @@ -1168,7 +1158,7 @@ parse_tile(bwc_codec *const field, bitstream *const 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; } @@ -1210,7 +1200,7 @@ parse_tile(bwc_codec *const field, bitstream *const stream) ! ! \*----------------------------------------------------------------------------------------------------------*/ static uchar -parse_body(bwc_codec *const field, bitstream *const stream) +parse_body(bwc_codec *const codec, bitstream *const stream) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -1226,7 +1216,7 @@ parse_body(bwc_codec *const field, bitstream *const stream) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); status = CODESTREAM_OK; @@ -1244,7 +1234,7 @@ parse_body(bwc_codec *const field, bitstream *const stream) { case SOT: { - if(parse_tile(field, stream)) + if(parse_tile(codec, stream)) { status |= CODESTREAM_ERROR; } @@ -1277,7 +1267,7 @@ parse_body(bwc_codec *const field, bitstream *const stream) { // Invalid Codestream fprintf(stderr, CSERROR); - bwc_free_codec(field); + bwc_free_codec(codec); status |= CODESTREAM_ERROR; break; } @@ -1287,7 +1277,7 @@ parse_body(bwc_codec *const field, bitstream *const stream) { // Invalid Codestream fprintf(stderr, CSERROR); - bwc_free_codec(field); + bwc_free_codec(codec); status |= CODESTREAM_ERROR; 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: ! @@ -1317,14 +1307,14 @@ parse_body(bwc_codec *const field, bitstream *const stream) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! RETURN VALUE: ! ! ------------- ! ! Type Description ! ! ---- ----------- ! -! bwc_span* - Packed stream containing the compressed data set. ! +! bwc_span* - Packed stream containing the compressed data set. ! ! ! ! DEVELOPMENT HISTORY: ! ! -------------------- ! @@ -1335,7 +1325,7 @@ parse_body(bwc_codec *const field, bitstream *const stream) ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -1353,7 +1343,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); 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 ! ! bytes. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; 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 ! ! the code more readable. ! \*--------------------------------------------------------*/ - tile = &field->tile[i]; + tile = &codec->tile[i]; /*--------------------------------------------------------*\ ! Sequence the packets according to the user specified op- ! ! tion and iterate the size of the codestream. ! \*--------------------------------------------------------*/ - if(sequence_packets(field, tile)) + if(sequence_packets(codec, tile)) { return 0; } @@ -1395,7 +1385,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data) ! bytes. ! \*--------------------------------------------------------*/ 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 ! @@ -1408,9 +1398,9 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data) ! Save the tile structure in a temporary variable to make ! ! 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); @@ -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: ! @@ -1433,7 +1423,7 @@ assemble_codestream(bwc_codec *const field, bwc_stream *const data) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! stream bitstream* - Structure used to assemble a bwc bit- ! diff --git a/src/library/dwt.c b/src/library/dwt.c index 65615ee..c280e0d 100755 --- a/src/library/dwt.c +++ b/src/library/dwt.c @@ -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: ! @@ -1434,7 +1434,7 @@ initialize_gain_lut() ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! highband_flag uchar - Defines the subband for which Gb is ! @@ -1459,7 +1459,7 @@ initialize_gain_lut() ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -1480,15 +1480,15 @@ get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); - assert(level <= field->control.nDecomp + 1); + assert(codec); + assert(level <= codec->control.nDecomp + 1); assert(highband_flag <= DIM_ALL); /*--------------------------------------------------------*\ ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! 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) ! ! ! ! DESCRIPTION: ! @@ -1594,7 +1594,7 @@ get_dwt_energy_gain(bwc_codec *const field, uchar highband_flag, uint16 level) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! 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 -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: ! @@ -1646,7 +1646,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); 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 ! ! temporary variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; param_info = ¶meter->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) ! ! ! ! DESCRIPTION: ! @@ -2129,7 +2129,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! parameter bwc_parameter* - Structure defining a bwc parameter. ! @@ -2149,7 +2149,7 @@ forward_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -2181,7 +2181,7 @@ inverse_wavelet_transform(bwc_codec *const field, bwc_parameter *const parameter /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); 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 ! ! temporary variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; param_info = ¶meter->info; /*--------------------------------------------------------*\ diff --git a/src/library/libbwc.c b/src/library/libbwc.c index 00f754f..42b09cc 100755 --- a/src/library/libbwc.c +++ b/src/library/libbwc.c @@ -145,7 +145,7 @@ #endif /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: uint8 initialize_precinct(bwc_codec *const field, bwc_precinct *precinct, ! +! FUNCTION NAME: uint8 initialize_precinct(bwc_codec *const codec, bwc_precinct *precinct, ! ! -------------- const uint32 dX, const uint32 dY, ! ! const uint32 dZ, const uint32 dTS) ! ! ! @@ -157,7 +157,7 @@ ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! precinct bwc_precinct* - Structure defining a bwc precinct. ! @@ -180,7 +180,7 @@ ! ! \*----------------------------------------------------------------------------------------------------------*/ static uint8 -initialize_precinct(bwc_codec *const field, bwc_precinct *precinct, const uint32 dX, const uint32 dY, +initialize_precinct(bwc_codec *const codec, bwc_precinct *precinct, const uint32 dX, const uint32 dY, const uint32 dZ, const uint32 dTS) { /*-----------------------*\ @@ -202,7 +202,7 @@ initialize_precinct(bwc_codec *const field, bwc_precinct *precinct, const uint32 /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(precinct); /*--------------------------------------------------------*\ @@ -210,7 +210,7 @@ initialize_precinct(bwc_codec *const field, bwc_precinct *precinct, const uint32 ! and info structure to temporary variables to make the ! ! code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; prec_control = &precinct->control; prec_info = &precinct->info; @@ -386,7 +386,7 @@ static uint8 subband_gain(const uint8 highband_flag) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: uchar initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, ! +! FUNCTION NAME: uchar initialize_subband(bwc_codec *const codec, bwc_parameter *const parameter, ! ! -------------- bwc_resolution *const resolution, ! ! bwc_subband *const subband, ! ! int32 resolution_level, ! @@ -403,7 +403,7 @@ static uint8 subband_gain(const uint8 highband_flag) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! parameter bwc_parameter* - Structure defining a bwc tile parameter.! @@ -433,7 +433,7 @@ static uint8 subband_gain(const uint8 highband_flag) ! ! \*----------------------------------------------------------------------------------------------------------*/ static uchar -initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_resolution *const resolution, +initialize_subband(bwc_codec *const codec, bwc_parameter *const parameter, bwc_resolution *const resolution, bwc_subband *const subband, int32 resolution_level, int16 highband_flag) @@ -464,10 +464,10 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(resolution); assert(subband); - assert(resolution_level <= field->control.nDecomp + 1); + assert(resolution_level <= codec->control.nDecomp + 1); assert(highband_flag <= DIM_ALL); /*--------------------------------------------------------*\ @@ -475,7 +475,7 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r ! trol and info structures to temporary variables to make ! ! the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; param_control = ¶meter->control; param_info = ¶meter->info; @@ -523,7 +523,7 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r ! band. ! \*--------------------------------------------------------*/ subb_control->highband_flag = highband_flag; - subb_info->dwt_gain = get_dwt_energy_gain(field, highband_flag, decomp_level); + subb_info->dwt_gain = get_dwt_energy_gain(codec, highband_flag, decomp_level); /*--------------------------------------------------------*\ ! Evaluate the quantization exponent, mantissa, step size ! @@ -666,7 +666,7 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r ! Initialize the precinct structure according to the speci-! ! fied compression parameters. ! \*--------------------------------------------------------*/ - initialize_precinct(field, &subband->precinct[p], (uint32)sb_sX - subb_info->X0, (uint32)sb_sY - subb_info->Y0, + initialize_precinct(codec, &subband->precinct[p], (uint32)sb_sX - subb_info->X0, (uint32)sb_sY - subb_info->Y0, (uint32)sb_sZ - subb_info->Z0, (uint32)sb_sTS - subb_info->TS0); /*--------------------------------------------------------*\ @@ -684,7 +684,7 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void fill_buffer(bwc_codec *const field, bwc_tile *const tile, ! +! FUNCTION NAME: void fill_buffer(bwc_codec *const codec, bwc_tile *const tile, ! ! ------------ bwc_parameter *const parameter, ! ! bwc_sample *const working_buffer, ! ! double *const data, ! @@ -701,7 +701,7 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -732,7 +732,7 @@ initialize_subband(bwc_codec *const field, bwc_parameter *const parameter, bwc_r ! ! \*----------------------------------------------------------------------------------------------------------*/ static void -fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const parameter, +fill_buffer(bwc_codec *const codec, bwc_tile *const tile, bwc_parameter *const parameter, bwc_sample *const working_buffer, bwc_stream *const data, uint16 param_id) @@ -763,7 +763,7 @@ fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const p /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); assert(parameter); assert(working_buffer); @@ -774,7 +774,7 @@ fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const p ! structures to temporary variables to make the code more ! ! readable. ! \*--------------------------------------------------------*/ - info = &field->info; + info = &codec->info; tile_info = &tile->info; @@ -925,7 +925,7 @@ fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const p } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void fill_buffer(bwc_codec *const field, bwc_tile *const tile, ! +! FUNCTION NAME: void fill_buffer(bwc_codec *const codec, bwc_tile *const tile, ! ! ------------ bwc_parameter *const parameter, ! ! bwc_sample *const working_buffer, ! ! double *const data, ! @@ -941,7 +941,7 @@ fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const p ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -972,7 +972,7 @@ fill_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const p ! ! \*----------------------------------------------------------------------------------------------------------*/ static void -flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const parameter, +flush_buffer(bwc_codec *const codec, bwc_tile *const tile, bwc_parameter *const parameter, bwc_sample *const working_buffer, bwc_stream *const data, uint16 param_id) @@ -1001,7 +1001,7 @@ flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); assert(parameter); assert(working_buffer); @@ -1012,7 +1012,7 @@ flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const ! structures to temporary variables to make the code more ! ! readable. ! \*--------------------------------------------------------*/ - info = &field->info; + info = &codec->info; param_info = ¶meter->info; @@ -1126,7 +1126,7 @@ flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void buff_normalize(bwc_codec *const field, bwc_parameter *const parameter) ! +! FUNCTION NAME: void normalize_param(bwc_codec *const codec, bwc_parameter *const parameter) ! ! ! ! ! ! DESCRIPTION: ! @@ -1143,10 +1143,10 @@ flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! parameter bwc_parameter* - Structure defining a bwc parameter. ! +! codec bwc_codec* - Structure defining the compression/ ! +! decompression stage. ! ! ! -! working_buffer bwc_sample* - Working buffer used to store flow field ! -! data for a specific tile parameter. ! +! parameter bwc_parameter* - Structure defining a bwc parameter. ! ! ! ! RETURN VALUE: ! ! ------------- ! @@ -1163,7 +1163,7 @@ flush_buffer(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const ! ! \*----------------------------------------------------------------------------------------------------------*/ static void -normalize_param(bwc_codec *const field, bwc_parameter *const parameter) +normalize_param(bwc_codec *const codec, bwc_parameter *const parameter) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -1196,7 +1196,7 @@ normalize_param(bwc_codec *const field, bwc_parameter *const parameter) ! info structures to temporary variables to make the code ! ! more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; param_control = ¶meter->control; param_info = ¶meter->info; @@ -1251,7 +1251,7 @@ normalize_param(bwc_codec *const field, bwc_parameter *const parameter) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void denormalize_param(bwc_codec *const field, bwc_parameter *const parameter) ! +! FUNCTION NAME: void denormalize_param(bwc_codec *const codec, bwc_parameter *const parameter) ! ! ! ! ! ! DESCRIPTION: ! @@ -1268,10 +1268,10 @@ normalize_param(bwc_codec *const field, bwc_parameter *const parameter) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! parameter bwc_parameter* - Structure defining a bwc parameter. ! +! codec bwc_codec* - Structure defining the compression/ ! +! decompression stage. ! ! ! -! working_buffer bwc_sample* - Working buffer used to store flow field ! -! data for a specific tile parameter. ! +! parameter bwc_parameter* - Structure defining a bwc parameter. ! ! ! ! RETURN VALUE: ! ! ------------- ! @@ -1288,7 +1288,7 @@ normalize_param(bwc_codec *const field, bwc_parameter *const parameter) ! ! \*----------------------------------------------------------------------------------------------------------*/ static void -denormalize_param(bwc_codec *const field, bwc_parameter *const parameter) +denormalize_param(bwc_codec *const codec, bwc_parameter *const parameter) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -1320,7 +1320,7 @@ denormalize_param(bwc_codec *const field, bwc_parameter *const parameter) ! tures to temporary variables to make the code more ! ! readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; param_info = ¶meter->info; @@ -1608,19 +1608,19 @@ bwc_free_data(bwc_stream* data) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: uchar create_field(bwc_codec *const field) ! +! FUNCTION NAME: uchar create_codec(bwc_codec *const codec) ! ! -------------- ! ! ! ! DESCRIPTION: ! ! ------------ ! -! This function creates the field structure used to (de)compress a floating point array de- ! +! This function creates the codec structure used to (de)compress a floating point array de- ! ! fined by the bwc_initialize function. ! ! ! ! PARAMETERS: ! ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! RETURN VALUE: ! @@ -1638,7 +1638,7 @@ bwc_free_data(bwc_stream* data) ! ! \*----------------------------------------------------------------------------------------------------------*/ uchar -create_field(bwc_codec *const field) +create_codec(bwc_codec *const codec) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -1675,14 +1675,14 @@ create_field(bwc_codec *const field) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Calculate the number of tiles in all spatial and tempo- ! @@ -1694,8 +1694,8 @@ create_field(bwc_codec *const field) num_tiles_Z = (int)ceil(((float)info->nZ / control->tileSizeZ)); num_tiles_TS = (int)ceil(((float)info->nTS/ control->tileSizeTS)); - field->tile = calloc(control->nTiles, sizeof(bwc_tile)); - if(!field->tile) + codec->tile = calloc(control->nTiles, sizeof(bwc_tile)); + if(!codec->tile) { // memory allocation error fprintf(stderr, MEMERROR); @@ -1725,7 +1725,7 @@ create_field(bwc_codec *const field) ! Save the tile and its info and control structure to tem- ! ! porary variables to make the code more readable. ! \*--------------------------------------------------------*/ - tile = &field->tile[i]; + tile = &codec->tile[i]; tile_control = &tile->control; tile_info = &tile->info; @@ -1936,7 +1936,7 @@ create_field(bwc_codec *const field) { if(r == 0 || ((l & highband_flag) == l && l != 0)) { - if(initialize_subband(field, parameter, resolution, &resolution->subband[m], r, l)) + if(initialize_subband(codec, parameter, resolution, &resolution->subband[m], r, l)) { return 1; } @@ -2012,12 +2012,12 @@ create_field(bwc_codec *const field) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void kill_compression(bwc_codec *const field) ! +! FUNCTION NAME: void bwc_free_compression(bwc_codec *const codec) ! ! -------------- ! ! ! ! DESCRIPTION: ! ! ------------ ! -! This function deallocates the compression field structure used to define and control the ! +! This function deallocates the compression codec structure used to define and control the ! ! bwc codec and can be called if an error occurs during the (de-)compression stage or once ! ! the codec has finished. The deallocation will be carried out down to the structure levels ! ! that have been allocated. ! @@ -2027,7 +2027,7 @@ create_field(bwc_codec *const field) ! ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! RETURN VALUE: ! @@ -2360,7 +2360,7 @@ bwc_alloc_decoder() } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_error_resilience(bwc_codec *const field) ! +! FUNCTION NAME: void bwc_set_error_resilience(bwc_codec *const codec) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -2372,7 +2372,7 @@ bwc_alloc_decoder() ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! RETURN VALUE: ! @@ -2390,7 +2390,7 @@ bwc_alloc_decoder() ! ! \*----------------------------------------------------------------------------------------------------------*/ void -bwc_set_error_resilience(bwc_codec *const field) +bwc_set_error_resilience(bwc_codec *const codec) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -2400,13 +2400,13 @@ bwc_set_error_resilience(bwc_codec *const field) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! Amend the codeblock style in the bwc_codec structure ! @@ -2422,7 +2422,7 @@ bwc_set_error_resilience(bwc_codec *const field) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_quant_style(bwc_codec *const field, bwc_quant_st quantization_style) ! +! FUNCTION NAME: void bwc_set_quant_style(bwc_codec *const codec, bwc_quant_st quantization_style) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -2434,7 +2434,7 @@ bwc_set_error_resilience(bwc_codec *const field) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! quantization_style bwc_quant_st - Quantization style used during compres- ! @@ -2455,7 +2455,7 @@ bwc_set_error_resilience(bwc_codec *const field) ! ! \*----------------------------------------------------------------------------------------------------------*/ void -set_quant_style(bwc_codec *const field, bwc_quant_st quantization_style) +set_quant_style(bwc_codec *const codec, bwc_quant_st quantization_style) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -2465,14 +2465,14 @@ set_quant_style(bwc_codec *const field, bwc_quant_st quantization_style) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert((quantization_style == bwc_qt_derived) || (quantization_style == bwc_qt_none)); /*--------------------------------------------------------*\ ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! Amend the quantization style in the bwc_codec structure ! @@ -2488,7 +2488,7 @@ set_quant_style(bwc_codec *const field, bwc_quant_st quantization_style) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_quant_step_size(bwc_codec *const field, double delta) ! +! FUNCTION NAME: void bwc_set_quant_step_size(bwc_codec *const codec, double delta) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -2500,7 +2500,7 @@ set_quant_style(bwc_codec *const field, bwc_quant_st quantization_style) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! delta double - Quantization step size used during ! @@ -2521,7 +2521,7 @@ set_quant_style(bwc_codec *const field, bwc_quant_st quantization_style) ! ! \*----------------------------------------------------------------------------------------------------------*/ void -set_quant_step_size(bwc_codec *const field, double delta) +set_quant_step_size(bwc_codec *const codec, double delta) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -2531,13 +2531,13 @@ set_quant_step_size(bwc_codec *const field, double delta) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! Check if the quantization step size lies within the ac- ! @@ -2592,7 +2592,7 @@ set_quant_step_size(bwc_codec *const field, double delta) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_progression(bwc_codec *const field, bwc_prog_ord progression) ! +! FUNCTION NAME: void set_progression(bwc_codec *const codec, bwc_prog_ord progression) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -2604,7 +2604,7 @@ set_quant_step_size(bwc_codec *const field, double delta) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! progression bwc_prog_ord - Progression orders employed during com- ! @@ -2626,7 +2626,7 @@ set_quant_step_size(bwc_codec *const field, double delta) ! ! \*----------------------------------------------------------------------------------------------------------*/ void -set_progression(bwc_codec *const field, bwc_prog_ord progression) +set_progression(bwc_codec *const codec, bwc_prog_ord progression) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -2636,7 +2636,7 @@ set_progression(bwc_codec *const field, bwc_prog_ord progression) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert((progression == bwc_prog_CPRL) || (progression == bwc_prog_LRCP) || (progression == bwc_prog_PCRL) || (progression == bwc_prog_RLCP) || (progression == bwc_prog_RPCL)); @@ -2645,7 +2645,7 @@ set_progression(bwc_codec *const field, bwc_prog_ord progression) ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! Amend the progression order in the bwc_codec structure ! @@ -2661,7 +2661,7 @@ set_progression(bwc_codec *const field, bwc_prog_ord progression) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_kernels(bwc_codec *const field, bwc_dwt_filter KernelX, ! +! FUNCTION NAME: void set_kernels(bwc_codec *const codec, bwc_dwt_filter KernelX, ! ! -------------- bwc_dwt_filter KernelY, ! ! bwc_dwt_filter KernelZ, ! ! bwc_dwt_filter KernelTS) ! @@ -2675,7 +2675,7 @@ set_progression(bwc_codec *const field, bwc_prog_ord progression) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! KernelX, KernelY, KernelZ bwc_dwt_filter - Wavelet kernels used for spatial ! @@ -2699,7 +2699,7 @@ set_progression(bwc_codec *const field, bwc_prog_ord progression) ! ! \*----------------------------------------------------------------------------------------------------------*/ void -set_kernels(bwc_codec *const field, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY, +set_kernels(bwc_codec *const codec, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY, bwc_dwt_filter KernelZ, bwc_dwt_filter KernelTS) { /*-----------------------*\ @@ -2710,13 +2710,13 @@ set_kernels(bwc_codec *const field, bwc_dwt_filter KernelX, bwc_dwt_filter Kerne /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! Amend the wavelet kernels in the bwc_codec structure ac- ! @@ -2737,7 +2737,7 @@ set_kernels(bwc_codec *const field, bwc_dwt_filter KernelX, bwc_dwt_filter Kerne } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, ! +! FUNCTION NAME: void bwc_set_decomp(bwc_codec *const codec, uint8 decompX, uint8 decompY, ! ! -------------- uint8 decompZ, uint8 decompTS) ! ! ! ! DESCRIPTION: ! @@ -2749,7 +2749,7 @@ set_kernels(bwc_codec *const field, bwc_dwt_filter KernelX, bwc_dwt_filter Kerne ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! decompX, decompY, decompZ unsigned int(8 bit) - Number of spatial wavelet decomposition ! @@ -2773,7 +2773,7 @@ set_kernels(bwc_codec *const field, bwc_dwt_filter KernelX, bwc_dwt_filter Kerne ! ! \*----------------------------------------------------------------------------------------------------------*/ void -bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decompZ, uint8 decompTS) +bwc_set_decomp(bwc_codec *const codec, uint8 decompX, uint8 decompY, uint8 decompZ, uint8 decompTS) { /*-----------------------*\ ! DEFINE FLOAT VARIABLES: ! @@ -2794,14 +2794,14 @@ bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decom /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Calculate the possible decomposition levels for all ! @@ -2863,7 +2863,7 @@ bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decom \*--------------------------------------------------------*/ if(initialize_gain_lut()) { - bwc_free_codec(field); + bwc_free_codec(codec); return; } @@ -2873,7 +2873,7 @@ bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decom ! tion (10.19) (epsilon = 6, mu = 16) from JPEG2000 by ! ! by David S. Taubman and Michael W. Marcellin (p.437). ! \*--------------------------------------------------------*/ - delta = 1/(pow(2, 2 + PREC_BIT) * sqrt(get_dwt_energy_gain(field, 0, control->nDecomp))); + delta = 1/(pow(2, 2 + PREC_BIT) * sqrt(get_dwt_energy_gain(codec, 0, control->nDecomp))); for(control->qt_exponent = 0; delta < 1; ++control->qt_exponent, delta *= 2); control->qt_mantissa = (uint16)floor(0.5f + ((delta - 1.0f) * (1 << 16))); @@ -2905,7 +2905,7 @@ bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decom } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_precincts(bwc_codec *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pTS) ! +! FUNCTION NAME: void bwc_set_precincts(bwc_codec *const codec, uint8 pX, uint8 pY, uint8 pZ, uint8 pTS) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -2917,7 +2917,7 @@ bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decom ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! px, py, pz, pTS unsigned int(8 bit) - Spatial and temporal precinct dimensions! @@ -2938,7 +2938,7 @@ bwc_set_decomp(bwc_codec *const field, uint8 decompX, uint8 decompY, uint8 decom ! ! \*----------------------------------------------------------------------------------------------------------*/ void -bwc_set_precincts(bwc_codec *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pTS) +bwc_set_precincts(bwc_codec *const codec, uint8 pX, uint8 pY, uint8 pZ, uint8 pTS) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -2949,14 +2949,14 @@ bwc_set_precincts(bwc_codec *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pT /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Check if the precinct sizes are specified for a valid ! @@ -3006,7 +3006,7 @@ bwc_set_precincts(bwc_codec *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pT } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_codeblocks(bwc_codec *const field, uint8 cbX, uint8 cbY, ! +! FUNCTION NAME: void bwc_set_codeblocks(bwc_codec *const codec, uint8 cbX, uint8 cbY, ! ! -------------- uint8 cbZ, uint8 cbTS) ! ! ! ! DESCRIPTION: ! @@ -3018,7 +3018,7 @@ bwc_set_precincts(bwc_codec *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pT ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! cbx, cby, cbz, cbTS unsigned int(8 bit) - Spatial and temporal codeblock dimen- ! @@ -3039,7 +3039,7 @@ bwc_set_precincts(bwc_codec *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pT ! ! \*----------------------------------------------------------------------------------------------------------*/ void -bwc_set_codeblocks(bwc_codec *const field, uint8 cbX, uint8 cbY, uint8 cbZ, uint8 cbTS) +bwc_set_codeblocks(bwc_codec *const codec, uint8 cbX, uint8 cbY, uint8 cbZ, uint8 cbTS) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -3050,14 +3050,14 @@ bwc_set_codeblocks(bwc_codec *const field, uint8 cbX, uint8 cbY, uint8 cbZ, uint /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Check if the codeblock sizes are specified for a valid ! @@ -3107,7 +3107,7 @@ bwc_set_codeblocks(bwc_codec *const field, uint8 cbX, uint8 cbY, uint8 cbZ, uint } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_qm(bwc_codec *const field, uint8 Qm) ! +! FUNCTION NAME: void bwc_set_qm(bwc_codec *const codec, uint8 Qm) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -3119,7 +3119,7 @@ bwc_set_codeblocks(bwc_codec *const field, uint8 cbX, uint8 cbY, uint8 cbZ, uint ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! Qm unsigned int(8 bit) - Q number formate range (m). ! @@ -3139,7 +3139,7 @@ bwc_set_codeblocks(bwc_codec *const field, uint8 cbX, uint8 cbY, uint8 cbZ, uint ! ! \*----------------------------------------------------------------------------------------------------------*/ void -bwc_set_qm(bwc_codec *const field, uint8 Qm) +bwc_set_qm(bwc_codec *const codec, uint8 Qm) { /*-----------------------*\ ! DEFINE STRUCTS: ! @@ -3149,13 +3149,13 @@ bwc_set_qm(bwc_codec *const field, uint8 Qm) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); /*--------------------------------------------------------*\ ! Save the global control structure to a temporary varia- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! Check if the Q number formate range is valid and amend ! @@ -3188,7 +3188,7 @@ bwc_set_qm(bwc_codec *const field, uint8 Qm) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_set_tiles(bwc_codec *const field, uint32 tilesX, uint32 tilesY, uint32 tilesZ, ! +! FUNCTION NAME: void bwc_set_tiles(bwc_codec *const codec, uint32 tilesX, uint32 tilesY, uint32 tilesZ, ! ! -------------- uint32 tilesTS, uchar instr) ! ! ! ! DESCRIPTION: ! @@ -3201,7 +3201,7 @@ bwc_set_qm(bwc_codec *const field, uint8 Qm) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tilesX, tilesY, tilesZ unsigned int(32 bit) - Variables defining the size of ! @@ -3228,7 +3228,7 @@ bwc_set_qm(bwc_codec *const field, uint8 Qm) ! ! \*----------------------------------------------------------------------------------------------------------*/ void -bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tilesZ, uint64 tilesTS, bwc_tile_instr instr) +bwc_set_tiles(bwc_codec *const codec, uint64 tilesX, uint64 tilesY, uint64 tilesZ, uint64 tilesTS, bwc_tile_instr instr) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -3244,15 +3244,15 @@ bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tiles /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(instr == bwc_tile_sizeof || instr == bwc_tile_numbof); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Check if the size of one tile or the overall number of ! @@ -3415,12 +3415,12 @@ bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tiles } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: void bwc_create_compression(bwc_codec *field, char *rate_control) ! +! FUNCTION NAME: void bwc_create_compression(bwc_codec *codec, char *rate_control) ! ! -------------- ! ! ! ! DESCRIPTION: ! ! ------------ ! -! This function creates the field structure used to compress a floating point array defined ! +! This function creates the codec structure used to compress a floating point array defined ! ! by the bwc_initialize function. For a compression run, the rate_control and instr arguments ! ! need to be passed to the function to properly set up the lossy compression stage. Here, the ! ! instr parameter defines whether rate control is defined by a BITRATE - a floating point val-! @@ -3431,7 +3431,7 @@ bwc_set_tiles(bwc_codec *const field, uint64 tilesX, uint64 tilesY, uint64 tiles ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! rate_control char* - Variable defining the bitrate. ! @@ -3577,7 +3577,7 @@ bwc_create_compression(bwc_codec *codec, bwc_stream *stream, char *rate_control) ! Create the codec structure used to compress a floating ! ! point array defined by the bwc_initialize function. ! \*--------------------------------------------------------*/ - if(create_field(codec)) + if(create_codec(codec)) { return 1; } @@ -3616,7 +3616,7 @@ bwc_create_compression(bwc_codec *codec, bwc_stream *stream, char *rate_control) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: uchar bwc_compress(bwc_codec *const field, bwc_float *const data) ! +! FUNCTION NAME: uchar bwc_compress(bwc_codec *const codec, bwc_float *const data) ! ! -------------- ! ! ! ! DESCRIPTION: ! @@ -3627,7 +3627,7 @@ bwc_create_compression(bwc_codec *codec, bwc_stream *stream, char *rate_control) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! RETURN VALUE: ! @@ -3645,7 +3645,7 @@ bwc_create_compression(bwc_codec *codec, bwc_stream *stream, char *rate_control) ! ! \*----------------------------------------------------------------------------------------------------------*/ size_t -bwc_compress(bwc_codec *const field, bwc_stream *const data) +bwc_compress(bwc_codec *const codec, bwc_stream *const data) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -3691,7 +3691,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(data); /*--------------------------------------------------------*\ @@ -3709,8 +3709,8 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Evaluate the working buffer size and allocate it accord- ! @@ -3737,7 +3737,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) ! Save the tile structure in a temporary variable to make ! ! the code more readable. ! \*--------------------------------------------------------*/ - tile = &field->tile[i]; + tile = &codec->tile[i]; for(p = 0; p < info->nPar; ++p) { @@ -3758,7 +3758,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - fill_buffer(field, tile, parameter, working_buffer, data, p); + fill_buffer(codec, tile, parameter, working_buffer, data, p); #ifdef BWC_PROFILE #if defined (_OPENMP) end = omp_get_wtime(); @@ -3781,7 +3781,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - normalize_param(field, parameter); + normalize_param(codec, parameter); #ifdef BWC_PROFILE #if defined (_OPENMP) end = omp_get_wtime(); @@ -3802,7 +3802,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - if(forward_wavelet_transform(field, parameter)) + if(forward_wavelet_transform(codec, parameter)) { free(working_buffer); return 0; @@ -3827,7 +3827,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - if(t1_encode(field, tile, parameter)) + if(t1_encode(codec, tile, parameter)) { free(working_buffer); return 0; @@ -3858,7 +3858,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - if(t2_encode(field, tile)) + if(t2_encode(codec, tile)) { free(working_buffer); return 0; @@ -3883,7 +3883,7 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - compressed_size = assemble_codestream(field, data); + compressed_size = assemble_codestream(codec, data); if(compressed_size == 0) { free(working_buffer); @@ -3941,19 +3941,20 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: uchar bwc_create_compression(bwc_codec *field_ptr, char *rate_control, uchar instr) ! -! -------------- ! +! FUNCTION NAME: uchar bwc_create_compression(bwc_codec *const codec, bwc_stream *const stream, ! +! -------------- uint8 layer) ! +! ! ! ! ! DESCRIPTION: ! ! ------------ ! -! This function parses the supplied bwc codestream and sets up the field structure used to ! +! This function parses the supplied bwc codestream and sets up the codec structure used to ! ! decompress the numerical dataset. ! ! ! ! PARAMETERS: ! ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! rate_control (opt) char* - Variable defining the bitrate/accuracy. ! @@ -3976,37 +3977,33 @@ bwc_compress(bwc_codec *const field, bwc_stream *const data) ! ! \*----------------------------------------------------------------------------------------------------------*/ uchar -bwc_create_decompression(bwc_codec *const decoder, bwc_stream *const stream, uint8 layer) +bwc_create_decompression(bwc_codec *const codec, bwc_stream *const stream, uint8 layer) { /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(decoder); + assert(codec); assert(stream); /*--------------------------------------------------------*\ - ! Parse the stream and setup the decoder. ! + ! Parse the stream and setup the codec. ! \*--------------------------------------------------------*/ - parse_codestream(decoder, stream, layer); - if(!decoder) + parse_codestream(codec, stream, layer); + if(!codec) { return 1; } - /*--------------------------------------------------------*\ - ! If successful, return the decoder structure to the func- ! - ! tion caller. ! - \*--------------------------------------------------------*/ return 0; } /*----------------------------------------------------------------------------------------------------------*\ -! FUNCTION NAME: uchar bwc_create_compression(bwc_codec *field, float rate_control, uchar instr) ! +! FUNCTION NAME: uchar bwc_create_compression(bwc_codec *codec, float rate_control, uchar instr) ! ! -------------- ! ! ! ! DESCRIPTION: ! ! ------------ ! -! This function creates the field structure used to compress a floating point array defined ! +! This function creates the codec structure used to compress a floating point array defined ! ! by the bwc_initialize function at a prescribed bitrate or accuracy. In this context, the ! ! bitrate is a floating point value defining the average number of bits per datapoint and ! ! the accuracy is an integer value defining the exponent of the maximum allowable error ! @@ -4016,7 +4013,7 @@ bwc_create_decompression(bwc_codec *const decoder, bwc_stream *const stream, uin ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! rate_control float - Variable defining the bitrate/accuracy. ! @@ -4039,7 +4036,7 @@ bwc_create_decompression(bwc_codec *const decoder, bwc_stream *const stream, uin ! ! \*----------------------------------------------------------------------------------------------------------*/ uchar -bwc_decompress(bwc_codec *const field, bwc_stream *const data) +bwc_decompress(bwc_codec *const codec, bwc_stream *const data) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -4075,7 +4072,7 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(data); /*--------------------------------------------------------*\ @@ -4093,8 +4090,8 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! Evaluate the working buffer size and allocate it accord- ! @@ -4121,7 +4118,7 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) ! Save the tile structure in a temporary variable to make ! ! the code more readable. ! \*--------------------------------------------------------*/ - tile = &field->tile[i]; + tile = &codec->tile[i]; for(p = 0; p < info->nPar; ++p) { @@ -4147,7 +4144,7 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - if(t1_decode(field, tile, parameter)) + if(t1_decode(codec, tile, parameter)) { free(working_buffer); return 1; @@ -4172,7 +4169,7 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - if(inverse_wavelet_transform(field, parameter)) + if(inverse_wavelet_transform(codec, parameter)) { free(working_buffer); return 1; @@ -4198,7 +4195,7 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - denormalize_param(field, parameter); + denormalize_param(codec, parameter); #ifdef BWC_PROFILE #if defined (_OPENMP) end = omp_get_wtime(); @@ -4221,7 +4218,7 @@ bwc_decompress(bwc_codec *const field, bwc_stream *const data) start = (double)clock(); #endif #endif - flush_buffer(field, tile, parameter, working_buffer, data, p); + flush_buffer(codec, tile, parameter, working_buffer, data, p); #ifdef BWC_PROFILE #if defined (_OPENMP) end = omp_get_wtime(); diff --git a/src/library/tier1.c b/src/library/tier1.c index 318b3e5..1bc59fc 100755 --- a/src/library/tier1.c +++ b/src/library/tier1.c @@ -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, ! ! const uint64 width, ! ! const uint64 height, ! @@ -2300,7 +2300,7 @@ compute_convex_hull(bwc_encoded_cblk *const encoded_codeblock, double *const mse ! ! \*----------------------------------------------------------------------------------------------------------*/ 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, const uint64 width, const uint64 height, @@ -2333,7 +2333,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(access); assert(codeblock); 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 ! ! to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; subb_ctrl = &access->subband->control; 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, ! ! const uint64 width, ! ! const uint64 height, ! @@ -2621,7 +2621,7 @@ encode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, ! ! \*----------------------------------------------------------------------------------------------------------*/ 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, const uint64 width, const uint64 height, @@ -2645,7 +2645,7 @@ decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(access); assert(codeblock); 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 ! ! readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; subb_ctrl = &access->subband->control; @@ -2821,7 +2821,7 @@ decode_codeblock(bwc_codec *const field, bwc_cblk_access *const access, ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -2849,7 +2849,7 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); 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- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! 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 ! ! the bwc_encoded_cblk structure. ! \*--------------------------------------------------------*/ - encode_codeblock(field, ¶meter->access[c], working_buffer, + encode_codeblock(codec, ¶meter->access[c], working_buffer, cbSizeX, cbSizeY, cbSizeZ, cbSizeTS); @@ -3123,7 +3123,7 @@ t1_encode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -3149,7 +3149,7 @@ t1_decode(bwc_codec *const field, bwc_tile *const tile, bwc_parameter *const par /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); 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- ! ! ble to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; + control = &codec->control; /*--------------------------------------------------------*\ ! 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) { - decode_codeblock(field, ¶meter->access[c], working_buffer, + decode_codeblock(codec, ¶meter->access[c], working_buffer, cbSizeX, cbSizeY, cbSizeZ, cbSizeTS); } diff --git a/src/library/tier2.c b/src/library/tier2.c index c492162..7aa0c9d 100755 --- a/src/library/tier2.c +++ b/src/library/tier2.c @@ -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, ! -! -------------- bwc_resolution *const resolution, ! -! uint32 const prec_idx, ! -! int8 const q_layer, ! -! uchar const est) ! +! FUNCTION NAME: int64 create_packet(bwc_tile *const tile, bwc_resolution *const resolution, ! +! -------------- uint32 const prec_idx, ! +! int8 const q_layer, ! +! uchar const est) ! ! ! ! DESCRIPTION: ! ! ------------ ! @@ -403,9 +402,6 @@ decode_length(bitstream *const header, bwc_codeblock *const codeblock, int8 cons ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! -! decompression stage. ! -! ! ! tile bwc_tile* - Structure defining a bwc tile. ! ! ! ! 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 -create_packet(bwc_codec *const field, bwc_tile *const tile, - bwc_resolution *const resolution, - uint32 const prec_idx, - int16 const q_layer, - uchar const est) +create_packet(bwc_tile *const tile, bwc_resolution *const resolution, + uint32 const prec_idx, + int16 const q_layer, + uchar const est) { /*-----------------------*\ ! DEFINE INT VARIABLES: ! @@ -463,7 +458,6 @@ create_packet(bwc_codec *const field, bwc_tile *const tile, /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); assert(tile); 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: ! @@ -734,7 +728,7 @@ create_packet(bwc_codec *const field, bwc_tile *const tile, ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -754,7 +748,7 @@ create_packet(bwc_codec *const field, bwc_tile *const tile, ! ! \*----------------------------------------------------------------------------------------------------------*/ 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: ! @@ -775,15 +769,15 @@ create_packets(bwc_codec *const field, bwc_tile *const tile) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; /*--------------------------------------------------------*\ ! 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) { - if(create_packet(field, tile, resolution, p, l, 0) < 0) + if(create_packet(tile, resolution, p, l, 0) < 0) { // memory allocation error 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, ! ! int16 const q_layer, ! ! uchar const est) ! @@ -871,7 +865,7 @@ create_packets(bwc_codec *const field, bwc_tile *const tile) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -899,7 +893,7 @@ create_packets(bwc_codec *const field, bwc_tile *const tile) ! ! \*----------------------------------------------------------------------------------------------------------*/ 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, int16 const q_layer, uchar const est) @@ -927,15 +921,15 @@ create_quality_layer(bwc_codec *const field, bwc_tile *const tile, /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! ! variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; 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) { - 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) { @@ -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 ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! 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 -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: ! @@ -1142,15 +1136,15 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile) /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); /*--------------------------------------------------------*\ ! Save the global and tile control and info structure to ! ! temporary variables to make the code more readable. ! \*--------------------------------------------------------*/ - control = &field->control; - info = &field->info; + control = &codec->control; + info = &codec->info; tile_control = &tile->control; 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; - 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) { @@ -1245,7 +1239,7 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile) 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) { @@ -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: ! @@ -1280,7 +1274,7 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -1300,19 +1294,19 @@ create_quality_layers(bwc_codec *const field, bwc_tile *const tile) ! ! \*----------------------------------------------------------------------------------------------------------*/ uchar -t2_encode(bwc_codec *const field, bwc_tile *const tile) +t2_encode(bwc_codec *const codec, bwc_tile *const tile) { /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); /*--------------------------------------------------------*\ ! Create the quality layers according to the bitrate val- ! ! ues provided by the user. ! \*--------------------------------------------------------*/ - if(create_quality_layers(field, tile)) + if(create_quality_layers(codec, tile)) { 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 ! ! evaluated in the previous step. ! \*--------------------------------------------------------*/ - if(create_packets(field, tile)) + if(create_packets(codec, tile)) { 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, ! ! uint64 const body_size) ! ! ! @@ -1343,7 +1337,7 @@ t2_encode(bwc_codec *const field, bwc_tile *const tile) ! ----------- ! ! Variable Type Description ! ! -------- ---- ----------- ! -! field bwc_codec* - Structure defining the compression/ ! +! codec bwc_codec* - Structure defining the compression/ ! ! decompression stage. ! ! ! ! tile bwc_tile* - Structure defining a bwc tile. ! @@ -1367,7 +1361,7 @@ t2_encode(bwc_codec *const field, bwc_tile *const tile) ! ! \*----------------------------------------------------------------------------------------------------------*/ 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, uint64 const body_size) { @@ -1393,7 +1387,7 @@ parse_packet(bwc_codec *const field, bwc_tile *const tile, /*-----------------------*\ ! DEFINE ASSERTIONS: ! \*-----------------------*/ - assert(field); + assert(codec); assert(tile); 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 ! ! codestream... ! \*--------------------------------------------------------*/ - if(field->control.error_resilience) + if(codec->control.error_resilience) { /*--------------------------------------------------------*\ ! check if the next symbol corresponds to the end of pack- !