jabcode
|
Symbol encoding. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "jabcode.h"
#include "encoder.h"
#include "ldpc.h"
#include "detector.h"
#include "decoder.h"
Functions | |
void | genColorPalette (jab_int32 color_number, jab_byte *palette) |
Generate color palettes with more than 8 colors. More... | |
void | setDefaultPalette (jab_int32 color_number, jab_byte *palette) |
Set default color palette. More... | |
void | setDefaultEccLevels (jab_int32 symbol_number, jab_byte *ecc_levels) |
Set default error correction levels. More... | |
void | swap_int (jab_int32 *a, jab_int32 *b) |
Swap two integer elements. More... | |
void | swap_byte (jab_byte *a, jab_byte *b) |
Swap two byte elements. More... | |
void | convert_dec_to_bin (jab_int32 dec, jab_char *bin, jab_int32 start_position, jab_int32 length) |
Convert decimal to binary. More... | |
jab_encode * | createEncode (jab_int32 color_number, jab_int32 symbol_number) |
Create encode object. More... | |
void | destroyEncode (jab_encode *enc) |
Destroy encode object. More... | |
jab_int32 * | analyzeInputData (jab_data *input, jab_int32 *encoded_length) |
Analyze the input data and determine the optimal encoding modes for each character. More... | |
jab_boolean | isDefaultMode (jab_encode *enc) |
Check if master symbol shall be encoded in default mode. More... | |
jab_int32 | getMetadataLength (jab_encode *enc, jab_int32 index) |
Calculate the (encoded) metadata length. More... | |
jab_int32 | getSymbolCapacity (jab_encode *enc, jab_int32 index) |
Calculate the data capacity of a symbol. More... | |
void | getOptimalECC (jab_int32 capacity, jab_int32 net_data_length, jab_int32 *wcwr) |
Get the optimal error correction capability. More... | |
jab_data * | encodeData (jab_data *data, jab_int32 encoded_length, jab_int32 *encode_seq) |
Encode the input data. More... | |
jab_boolean | encodeMasterMetadata (jab_encode *enc) |
Encode metadata. More... | |
jab_boolean | updateMasterMetadataPartII (jab_encode *enc, jab_int32 mask_ref) |
Update master symbol metadata PartII if the default masking reference is changed. More... | |
void | placeMasterMetadataPartII (jab_encode *enc) |
Update master symbol metadata PartII if the default masking reference is changed. More... | |
void | getColorPaletteIndex (jab_byte *index, jab_int32 index_size, jab_int32 color_number) |
Get color index for the color palette. More... | |
jab_boolean | createMatrix (jab_encode *enc, jab_int32 index, jab_data *ecc_encoded_data) |
Create symbol matrix. More... | |
void | swap_symbols (jab_encode *enc, jab_int32 index1, jab_int32 index2) |
Swap two symbols. More... | |
jab_boolean | assignDockedSymbols (jab_encode *enc) |
Assign docked symbols to their hosts. More... | |
jab_code * | getCodePara (jab_encode *enc) |
Calculate the code parameters according to the input symbols. More... | |
jab_boolean | createBitmap (jab_encode *enc, jab_code *cp) |
Create bitmap for the code. More... | |
jab_boolean | checkDockedSymbolSize (jab_encode *enc) |
Checks if the docked symbol sizes are valid. More... | |
jab_boolean | setMasterSymbolVersion (jab_encode *enc, jab_data *encoded_data) |
Set the minimal master symbol version. More... | |
jab_boolean | addE2SlaveMetadata (jab_symbol *slave) |
Add variable E to slave symbol metadata the data payload for each symbol. More... | |
void | updateSlaveMetadataE (jab_encode *enc, jab_int32 host_index, jab_int32 slave_index) |
Update slave metadata E in its host data stream. More... | |
jab_boolean | fitDataIntoSymbols (jab_encode *enc, jab_data *encoded_data) |
Set the data payload for each symbol. More... | |
jab_boolean | InitSymbols (jab_encode *enc) |
Initialize symbols. More... | |
jab_boolean | setSlaveMetadata (jab_encode *enc) |
Set metadata for slave symbols. More... | |
jab_int32 | generateJABCode (jab_encode *enc, jab_data *data) |
Generate JABCode. More... | |
void | reportError (jab_char *message) |
Report error message. More... | |
Symbol encoding.
libjabcode - JABCode Encoding/Decoding Library
Copyright 2016 by Fraunhofer SIT. All rights reserved. See LICENSE file for full terms of use and distribution.
Contact: Huajian Liu liu@s Waldemar Berchtold it.f raunh ofer .dewalde mar. berch told @sit. frau nhofe r.de
jab_boolean addE2SlaveMetadata | ( | jab_symbol * | slave | ) |
Add variable E to slave symbol metadata the data payload for each symbol.
slave | the slave symbol |
jab_int32* analyzeInputData | ( | jab_data * | input, |
jab_int32 * | encoded_length | ||
) |
Analyze the input data and determine the optimal encoding modes for each character.
input | the input character data |
encoded_length | the shortest encoding length |
jab_boolean assignDockedSymbols | ( | jab_encode * | enc | ) |
Assign docked symbols to their hosts.
enc | the encode parameters |
jab_boolean checkDockedSymbolSize | ( | jab_encode * | enc | ) |
Checks if the docked symbol sizes are valid.
enc | the encode parameters |
void convert_dec_to_bin | ( | jab_int32 | dec, |
jab_char * | bin, | ||
jab_int32 | start_position, | ||
jab_int32 | length | ||
) |
Convert decimal to binary.
dec | the decimal value |
bin | the data in binary representation |
start_position | the position to write in encoded data array |
length | the length of the converted binary sequence |
jab_boolean createBitmap | ( | jab_encode * | enc, |
jab_code * | cp | ||
) |
Create bitmap for the code.
enc | the encode parameters |
cp | the code parameters |
jab_encode* createEncode | ( | jab_int32 | color_number, |
jab_int32 | symbol_number | ||
) |
Create encode object.
color_number | the number of module colors |
symbol_number | the number of symbols |
jab_boolean createMatrix | ( | jab_encode * | enc, |
jab_int32 | index, | ||
jab_data * | ecc_encoded_data | ||
) |
Create symbol matrix.
enc | the encode parameter |
index | the symbol index |
ecc_encoded_data | encoded data |
void destroyEncode | ( | jab_encode * | enc | ) |
Destroy encode object.
enc | the encode object |
Encode the input data.
data | the character input data |
encoded_length | the optimal encoding length |
encode_seq | the optimal encoding sequence |
jab_boolean encodeMasterMetadata | ( | jab_encode * | enc | ) |
Encode metadata.
enc | the encode parameters |
jab_boolean fitDataIntoSymbols | ( | jab_encode * | enc, |
jab_data * | encoded_data | ||
) |
Set the data payload for each symbol.
enc | the encode parameters |
encoded_data | the encoded message |
void genColorPalette | ( | jab_int32 | color_number, |
jab_byte * | palette | ||
) |
Generate color palettes with more than 8 colors.
color_number | the number of colors |
palette | the color palette |
jab_int32 generateJABCode | ( | jab_encode * | enc, |
jab_data * | data | ||
) |
Generate JABCode.
enc | the encode parameters |
data | the input data |
jab_code* getCodePara | ( | jab_encode * | enc | ) |
Calculate the code parameters according to the input symbols.
enc | the encode parameters |
void getColorPaletteIndex | ( | jab_byte * | index, |
jab_int32 | index_size, | ||
jab_int32 | color_number | ||
) |
Get color index for the color palette.
index | the color index in the palette |
index_size | the size of index |
color_number | the number of colors |
jab_int32 getMetadataLength | ( | jab_encode * | enc, |
jab_int32 | index | ||
) |
Calculate the (encoded) metadata length.
enc | the encode parameters |
index | the symbol index |
void getOptimalECC | ( | jab_int32 | capacity, |
jab_int32 | net_data_length, | ||
jab_int32 * | wcwr | ||
) |
Get the optimal error correction capability.
capacity | the symbol capacity |
net_data_length | the original data length |
wcwr | the LPDC parameters wc and wr |
jab_int32 getSymbolCapacity | ( | jab_encode * | enc, |
jab_int32 | index | ||
) |
Calculate the data capacity of a symbol.
enc | the encode parameters |
index | the symbol index |
jab_boolean InitSymbols | ( | jab_encode * | enc | ) |
Initialize symbols.
enc | the encode parameters |
jab_boolean isDefaultMode | ( | jab_encode * | enc | ) |
Check if master symbol shall be encoded in default mode.
enc | the encode parameters |
void placeMasterMetadataPartII | ( | jab_encode * | enc | ) |
Update master symbol metadata PartII if the default masking reference is changed.
enc | the encode parameter |
void reportError | ( | jab_char * | message | ) |
Report error message.
message | the error message |
void setDefaultEccLevels | ( | jab_int32 | symbol_number, |
jab_byte * | ecc_levels | ||
) |
Set default error correction levels.
symbol_number | the number of symbols |
ecc_levels | the ecc_level for each symbol |
void setDefaultPalette | ( | jab_int32 | color_number, |
jab_byte * | palette | ||
) |
Set default color palette.
color_number | the number of colors |
palette | the color palette |
jab_boolean setMasterSymbolVersion | ( | jab_encode * | enc, |
jab_data * | encoded_data | ||
) |
Set the minimal master symbol version.
enc | the encode parameters |
encoded_data | the encoded message |
jab_boolean setSlaveMetadata | ( | jab_encode * | enc | ) |
Set metadata for slave symbols.
enc | the encode parameters |
void swap_byte | ( | jab_byte * | a, |
jab_byte * | b | ||
) |
Swap two byte elements.
a | the first element |
b | the second element |
void swap_int | ( | jab_int32 * | a, |
jab_int32 * | b | ||
) |
Swap two integer elements.
a | the first element |
b | the second element |
void swap_symbols | ( | jab_encode * | enc, |
jab_int32 | index1, | ||
jab_int32 | index2 | ||
) |
Swap two symbols.
enc | the encode parameters |
index1 | the index number of the first symbol |
index2 | the index number of the second symbol |
jab_boolean updateMasterMetadataPartII | ( | jab_encode * | enc, |
jab_int32 | mask_ref | ||
) |
Update master symbol metadata PartII if the default masking reference is changed.
enc | the encode parameter |
mask_ref | the masking reference |
void updateSlaveMetadataE | ( | jab_encode * | enc, |
jab_int32 | host_index, | ||
jab_int32 | slave_index | ||
) |
Update slave metadata E in its host data stream.
enc | the encode parameters |
host_index | the host symbol index |
slave_index | the slave symbol index |