Conversation
* Link tag_tree to lib to include in testing
iszak
left a comment
There was a problem hiding this comment.
Thanks for the pull request.
This implementation looks correct, although I had to read T.800 B.10.2 few times as it's terse and hard to follow, I'm not sure I could have implemented it with that example alone.
I think a few simpler test cases may help (e.g. 1 level, 2 level, 3 level) but I understand it's not easy to create. I also think an intermediate representation could help usability but likely at the cost of performance.
Have a think and let me know if you want to make these improvements, otherwise we can merge as is.
jpc/src/tag_tree.rs
Outdated
| } | ||
|
|
||
| // TODO fix push_bit type signature for better return type | ||
| pub fn push_bit(&mut self, b: u8) -> Option<u8> { |
There was a problem hiding this comment.
I agree this signature could be better since we're not efficiently reading in the maximum amount of bits at a time. Is it possible to use a bit operator to read each bit in the u8?
Also I think we will need a encode method too to take a tag tree representation and write it to bits, so we may want an intermediate representation of the tag tree that's more user friendly and that will also allow us to query it to request the value at qi(m, n) which I don't think is currently implemented? This could also be used to better test the decoding as I don't think currently we validate/assert the node values at the lower levels
There was a problem hiding this comment.
The use of tag trees is pretty complex. There are several different things happening at once. I'm not sure what interface with the tag tree would be the most ergonomic. I'm planning to evolve things as the code surrounding tag tree use is written.
As far as encoding goes, the tag tree represents a 2d array of numbers. So an interface that takes a 2d array of numbers and spits out bits is probably what is needed for a first version.
* Add more testing for tag_tree * Fix bug when filling out full tag_tree * Change tag_tree interface to use bool * Cleanup: cw->_cw * Cleanup: println -> info * Improve logging for tag_tree * Include env-logger for test logging
|
I think the code is ready now. Let me know if you want more changes.
Added two new test cases. One of which helped me find a bug.
I'm not sure what you mean by this. |
|
Thanks for making the changes, I've merged it in. The intermediate implementation idea was a non-bit array representation of the tree e.g. with node structs but given there's a little more work to be done it can be looked at later. |
Added a tag tree decoder implementation as described in B.10.2. This is another step towards decoding packets and tiles.