Commit 5c8ffbaa authored by Michael Niedermayer's avatar Michael Niedermayer

qdm2: simplify arithmetic coder tables generation

Someone should rename the variables, theres nothing random in there
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent bb01be80
...@@ -54,8 +54,7 @@ static av_cold void softclip_table_init(void) { ...@@ -54,8 +54,7 @@ static av_cold void softclip_table_init(void) {
// random generated table // random generated table
static av_cold void rnd_table_init(void) { static av_cold void rnd_table_init(void) {
int i,j; int i,j;
uint32_t ldw,hdw; uint32_t ldw;
uint64_t tmp64_1;
uint64_t random_seed = 0; uint64_t random_seed = 0;
float delta = 1.0 / 16384.0; float delta = 1.0 / 16384.0;
for(i = 0; i < 4096 ;i++) { for(i = 0; i < 4096 ;i++) {
...@@ -67,22 +66,18 @@ static av_cold void rnd_table_init(void) { ...@@ -67,22 +66,18 @@ static av_cold void rnd_table_init(void) {
random_seed = 81; random_seed = 81;
ldw = i; ldw = i;
for (j = 0; j < 5 ;j++) { for (j = 0; j < 5 ;j++) {
random_dequant_index[i][j] = (uint8_t)((ldw / random_seed) & 0xFF); random_dequant_index[i][j] = ldw / random_seed;
ldw = (uint32_t)ldw % (uint32_t)random_seed; ldw %= random_seed;
tmp64_1 = (random_seed * 0x55555556); random_seed /= 3;
hdw = (uint32_t)(tmp64_1 >> 32);
random_seed = (uint64_t)(hdw + (ldw >> 31));
} }
} }
for (i = 0; i < 128 ;i++) { for (i = 0; i < 128 ;i++) {
random_seed = 25; random_seed = 25;
ldw = i; ldw = i;
for (j = 0; j < 3 ;j++) { for (j = 0; j < 3 ;j++) {
random_dequant_type24[i][j] = (uint8_t)((ldw / random_seed) & 0xFF); random_dequant_type24[i][j] = ldw / random_seed;
ldw = (uint32_t)ldw % (uint32_t)random_seed; ldw %= random_seed;
tmp64_1 = (random_seed * 0x66666667); random_seed /= 5;
hdw = (uint32_t)(tmp64_1 >> 33);
random_seed = hdw + (ldw >> 31);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment