On Mon, Oct 30, 2023 at 09:49:07PM +0100, Andreas Rheinhardt wrote: > Michael Niedermayer: [...] > > > > also i was wondering about a vlc reader thats entirely free of conditional > > branches. Just a loop that in each iteration would step by 0-n symbols > > forward and update a pointer to which table to use next > > Doesn't this have the downside that short symbols need as many > iterations as the longest one? i dont think so but maybe iam thinking of something else lets assume our main table is 10bits so we read 10 bits look it up in the table and that tells us what there is and lets assume these 10 bits contain 2 complete symbols and one partial first we copy from the table a block into our symbol output list (that contains 2 symbols) second we take a pointer from the table to the next table the incomplete can either now be handled in the next iteration or we could point back to the main 10bit table and only handle the 2 complete in this iteration third we move bits (10) and symbols output pointer (2) forward now we go back to the start of the loop and continue handling the partial symbol first we copy from the table a block into our symbol output list (that contains 0 symbols as our partial one still is unfinished) second we take a pointer from the table to the next table this is the next table to decode the long symbol third we move bits (10) and symbols output pointer (0) forward now we go back to the start of the loop and continue handling the partial symbol first we copy from the table a block into our symbol output list (that finally completes the long symbol so we output it) second we take a pointer from the table to the next which is back at the main table third we move bits (x) and symbols output pointer (1) forward thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML.