void AADec_FlushChoice(AADecoder *dec) { if (!bit_out_psc_layer(dec)) return; dec->code_value = 2 * dec->code_value + dec->Bit; if (!bit_out_psc_layer(dec)) return; dec->code_value = (2 * dec->code_value + dec->Bit) & AAM_TOP; dec->low = 0; dec->high = AAM_TOP; dec->zero_run = 0; }
void gp_bifs_aa_dec_flush(GF_AADecoder *dec) { if (!bit_out_psc_layer(dec)) return; dec->code_value = 2 * dec->code_value + dec->Bit; if (!bit_out_psc_layer(dec)) return; dec->code_value = (2 * dec->code_value + dec->Bit) & AAM_TOP; dec->low = 0; dec->high = AAM_TOP; dec->zero_run = 0; }
int decode_a_symbol (/*int cumul_freq[]*/ short *cumul_freq) { length = high - low + 1; cum = (-1 + (code_value - low + 1) * cumul_freq[0]) / length; for (sacindex = 1; cumul_freq[sacindex] > cum; sacindex++); high = low - 1 + (length * cumul_freq[sacindex - 1]) / cumul_freq[0]; low += (length * cumul_freq[sacindex]) / cumul_freq[0]; for (;;) { if (high < q2); else if (low >= q2) { code_value -= q2; low -= q2; high -= q2; } else if (low >= q1 && high < q3) { code_value -= q1; low -= q1; high -= q1; } else { break; } low *= 2; high = 2 * high + 1; bit_out_psc_layer (); code_value = 2 * code_value + bit; } return (sacindex - 1); }
void decoder_reset () { int i; zerorun = 0; /* clear consecutive zero's counter */ code_value = 0; low = 0; high = top; for (i = 1; i <= 16; i++) { bit_out_psc_layer (); code_value = 2 * code_value + bit; } }
void decoder_reset( ) { int i; zerorun = 0; /* clear consecutive zero's counter */ code_value = 0; low = 0; high = top; for (i = 1; i <= 16; i++) { bit_out_psc_layer(); code_value = 2 * code_value + bit; } if (trace) fputs("Arithmetic Decoder Reset \n",dlog); }