void Group::buildTransitionTable() { transition_table = TransitionTable(state_count); std::vector<int> arr(piece_count); for (int index = 0; index < state_count; index++) { for (int move = 0; move < 6; move++) { index_to_array(index, arr); apply_move(arr, move); transition_table[index][move] = array_to_index(arr); } } }
/*************************************************************************** Function: decode_vector_quantized_mlt_indices Syntax: void decode_vector_quantized_mlt_indices(Bit_Obj *bitobj, Int16 *decoder_region_standard_deviation, Int16 *decoder_power_categories, Int16 *decoder_mlt_coefs) inputs: Bit_Obj *bitobj Rand_Obj *randobj Int16 *decoder_region_standard_deviation Int16 *decoder_power_categories outputs: Int16 *decoder_mlt_coefs Description: Decode MLT coefficients Design Notes: WMOPS: 7kHz | 24kbit | 32kbit -------|--------------|---------------- AVG | 0.60 | 0.72 -------|--------------|---------------- MAX | 0.67 | 0.76 -------|--------------|---------------- 14kHz | 24kbit | 32kbit | 48kbit -------|--------------|----------------|---------------- AVG | 0.77 | 0.98 | 1.28 -------|--------------|----------------|---------------- MAX | 1.05 | 1.18 | 1.36 -------|--------------|----------------|---------------- ***************************************************************************/ void decode_vector_quantized_mlt_indices(Bit_Obj *bitobj, Int16 *decoder_region_standard_deviation, Int16 *decoder_power_categories, Int16 *decoder_mlt_coefs) { Int16 standard_deviation; Int16 *decoder_mlt_ptr; Int16 *raw_mlt_ptr; Int16 decoder_mlt_value; Int16 noifill[2]; Int16 noise_fill_factor[3] = {5793,8192,23170}; Int16 region; Int16 category; Int16 j, n; Int16 k[MAX_VECTOR_DIMENSION]; Int16 vec_dim; Int16 num_vecs; Int16 index; Int16 signs_index; Int16 bit; Int16 num_sign_bits; Int16 ran_out_of_bits_flag = 0; Int16 *decoder_table_ptr; Int16 random_word; Int16 temp; Int32 acca; raw_mlt_ptr = decoder_mlt_coefs; for (region = 0; region < NUMBER_OF_REGIONS; region++) { category = decoder_power_categories[region]; decoder_mlt_ptr = raw_mlt_ptr; standard_deviation = decoder_region_standard_deviation[region]; if (category < 7) { /* Get the proper table of decoder tables, vec_dim, and num_vecs for the cat */ decoder_table_ptr = (Int16 *) table_of_decoder_tables[category]; vec_dim = vector_dimension[category]; num_vecs = number_of_vectors[category]; for (n = 0; n < num_vecs; n++) { index = 0; /* get index */ do { if (bitobj->number_of_bits_left <= 0) { ran_out_of_bits_flag = 1; break; } get_next_bit(bitobj); temp = index << 1; index = decoder_table_ptr[temp + bitobj->next_bit]; bitobj->number_of_bits_left--; } while (index > 0); if (ran_out_of_bits_flag != 0) break; index = negate(index); /* convert index into array used to access the centroid table */ /* get the number of sign bits in the index */ num_sign_bits = index_to_array(index, k, category); if (bitobj->number_of_bits_left >= num_sign_bits) { if (num_sign_bits != 0) { signs_index = 0; for (j = 0; j < num_sign_bits; j++) { get_next_bit(bitobj); signs_index <<= 1; signs_index += bitobj->next_bit; bitobj->number_of_bits_left--; } temp = num_sign_bits - 1; bit = 1 << temp; } for (j = 0; j < vec_dim; j++) { acca = (Int32)standard_deviation * (Int32)mlt_quant_centroid[category][k[j]]; acca = acca >> 12; decoder_mlt_value = (Int16)acca; if (decoder_mlt_value != 0) { if ((signs_index & bit) == 0) decoder_mlt_value = negate(decoder_mlt_value); bit = bit >> 1; } *decoder_mlt_ptr++ = decoder_mlt_value; } } else { ran_out_of_bits_flag = 1; break; } } /* If ran out of bits during decoding do noise fill for remaining regions. */ /* DEBUG!! - For now also redo all of last region with all noise fill. */ if (ran_out_of_bits_flag != 0) { temp = add(region, 1); for (j = temp; j < NUMBER_OF_REGIONS; j++) { decoder_power_categories[j] = 7; } category = 7; } }