204 lines
6.7 KiB
C++
204 lines
6.7 KiB
C++
/*
|
|
|
|
Copyright (c) 2015 Harm Hanemaaijer <fgenfb@yahoo.com>
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
#include "detex.h"
|
|
#include "bits.h"
|
|
#include "bptc-tables.h"
|
|
|
|
const uint8_t detex_bptc_table_P2[64 * 16] = {
|
|
0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,
|
|
0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,
|
|
0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,
|
|
0,0,0,1,0,0,1,1,0,0,1,1,0,1,1,1,
|
|
0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,
|
|
0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,
|
|
0,0,0,1,0,0,1,1,0,1,1,1,1,1,1,1,
|
|
0,0,0,0,0,0,0,1,0,0,1,1,0,1,1,1,
|
|
0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,
|
|
0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,
|
|
0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,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2,2,2,2,2,2,2,2,
|
|
0,0,2,2,0,0,1,1,0,0,1,1,0,0,2,2,
|
|
0,0,2,2,1,1,2,2,1,1,2,2,0,0,2,2,
|
|
0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,2,
|
|
0,0,0,2,0,0,0,1,0,0,0,2,0,0,0,1,
|
|
0,2,2,2,1,2,2,2,0,2,2,2,1,2,2,2,
|
|
0,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,
|
|
0,1,1,1,2,0,1,1,2,2,0,1,2,2,2,0,
|
|
};
|
|
|
|
const uint8_t detex_bptc_table_anchor_index_second_subset[64] = {
|
|
15,15,15,15,15,15,15,15,
|
|
15,15,15,15,15,15,15,15,
|
|
15, 2, 8, 2, 2, 8, 8,15,
|
|
2, 8, 2, 2, 8, 8, 2, 2,
|
|
15,15, 6, 8, 2, 8,15,15,
|
|
2, 8, 2, 2, 2,15,15, 6,
|
|
6, 2, 6, 8,15,15, 2, 2,
|
|
15,15,15,15,15, 2, 2,15
|
|
};
|
|
|
|
const uint8_t detex_bptc_table_anchor_index_second_subset_of_three[64] = {
|
|
3, 3,15,15, 8, 3,15,15,
|
|
8, 8, 6, 6, 6, 5, 3, 3,
|
|
3, 3, 8,15, 3, 3, 6,10,
|
|
5, 8, 8, 6, 8, 5,15,15,
|
|
8,15, 3, 5, 6,10, 8,15,
|
|
15, 3,15, 5,15,15,15,15,
|
|
3,15, 5, 5, 5, 8, 5,10,
|
|
5,10, 8,13,15,12, 3, 3
|
|
};
|
|
|
|
const uint8_t detex_bptc_table_anchor_index_third_subset[64] = {
|
|
15, 8, 8, 3,15,15, 3, 8,
|
|
15,15,15,15,15,15,15, 8,
|
|
15, 8,15, 3,15, 8,15, 8,
|
|
3,15, 6,10,15,15,10, 8,
|
|
15, 3,15,10,10, 8, 9,10,
|
|
6,15, 8,15, 3, 6, 6, 8,
|
|
15, 3,15,15,15,15,15,15,
|
|
15,15,15,15, 3,15,15, 8
|
|
};
|
|
|
|
const uint16_t detex_bptc_table_aWeight2[4] = {
|
|
0, 21, 43, 64
|
|
};
|
|
|
|
const uint16_t detex_bptc_table_aWeight3[8] = {
|
|
0, 9, 18, 27, 37, 46, 55, 64
|
|
};
|
|
|
|
const uint16_t detex_bptc_table_aWeight4[16] = {
|
|
0, 4, 9, 13, 17, 21, 26, 30,
|
|
34, 38, 43, 47, 51, 55, 60, 64
|
|
};
|
|
|
|
|