Hi, Here are some observations on the Dirac spec (2.2.2) I made while writing a toy-decoder for dirac:
13.4.2.2: subband_coeffs() is missing "quant_index" in the parameter list 13.4.3.2: codeblock() Uses a local variable "band" that's not set in this function. (should be "band = coeff_data[level][orient]") 15.6.2: The lift2-4 functions use wrong parameters in the for statement. lift1 is correct ("for i = -N to M" vs. "for i = D to L + D - 1") Arithmetic decoder: There is no need for the arithmetic decoder to use the variable "state[LOW]". You can simply change count = state[CODE] - state[LOW] to count = state[CODE] and state[LOW] += range_times_prob to state[CODE] -= range_times_prob and simplify renormalise() to: state[RANGE] <<= 1 state[CODE] <<= 1 state[CODE] += read_bitb() (There is no need for the bit twiddling and the masking if state[LOW] always stays zero.) Short justification: In the end, state[LOW] is only used to calculate "count", which is the real state that the read_boola function is interested in. So anything that produces the correct value for "count" is valid. Now count is defined as: count = code - low The operation low' = low + range_times_prob changes "count" like this: count' = code - low - range_times_prob = count - range_times_prob The renormalise operation: low' = low * 2 code' = code * 2 + read_bitb changes "count" like this: count' = code * 2 + read_bitb - low * 2 = (code - low) * 2 + read_bitb = count * 2 + read_bitb So, it is possible to use "count" directly as a state variable instead of "code" and "low" and this greatly simplifies the renormalise function. Regards, Dennis Ranke ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Schrodinger-devel mailing list Schrodinger-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/schrodinger-devel