[Libre-soc-isa] [Bug 933] prefix-code (like huffman code) decode/encode instructions

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Oct 2 17:47:33 BST 2022


https://bugs.libre-soc.org/show_bug.cgi?id=933

--- Comment #38 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #37)
> (In reply to Jacob Lifshay from comment #36)
> > lkcl, what do you think of declaring this bug and the jpeg/mp3 bugs to be
> > completed, since there is a pcdec. instruction with working unittests and
> > the nlnet deadline is very close?
> 
> yep go for it,

ok, will do later

> can you show (somehow) the relationship to mp3?
> (a function in some source code that a "pcdec." loop replaces?)

found what is huffman decoding afaict (libmpg123 is used by latest LAME trunk
for mp3 decoding, it used to be vendored into LAME's source tree):
https://www.mpg123.de/cgi-bin/scm/mpg123/trunk/src/libmpg123/layer3.c?revision=4971&view=markup#l622
(reindented to fit)
619 const short *val = h->table;
620 REFRESH_MASK;
621 #ifdef USE_NEW_HUFFTABLE
622 while((y=val[(MASK_UTYPE)mask>>(BITSHIFT+4)])<0)
623 {
624     val -= y;
625     num -= 4;
626     mask <<= 4;
627 }
628 num -= (y >> 8);
629 mask <<= (y >> 8);
630 x = (y >> 4) & 0xf;
631 y &= 0xf;

that while loop would be replaced with a loop on a pcdec. instruction and would
need to loop 4/6 as often since pcdec. processes 6 bits at a time and that loop
processes 4 bits at a time.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libre-SOC-ISA mailing list