Hi all, I am interested in building a stand alone Rice Encoder/Decoder, using FLAC source code as a starting point. I've read the theory behind it, and I am very interested in info theory. However, I am struggling with how exactly I would implement the theory in code. I'm a newbie to computer science (only 1 year experience). I have read the format and documentation links on the FLAC website, as well as the archives of the mailing list...and I haven't found anyone doing something similar. I am new to doxygen and have never read or written anything as large as FLAC before. Right now, I am looking in the src code of libFLAC, (I am looking through stream_encoder.c in libFLAC src code), but its really confusing to someone who just learned what ./configure meant today. So any help in where I can find where the Rice encoder/decoder is implemented in the code (in libFLAC or libFLAC++) would be super helpful. -Mary P.S. I totally appreciate the very clean code and documentation! It's making the learning much less painful than I think it could be. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20060711/9d135fb7/attachment.html
On Tue, Jul 11, 2006 at 04:17:41PM -0700, Mary Amon wrote:> Right now, I am > looking in the src code of libFLAC, (I am looking through stream_encoder.c > in libFLAC src code), but its really confusing to someone who just learned > what ./configure meant today.Well, configure is obfuscating, but that's not really the problem. You're on the right track; the rice encode/decode stuff is all in libFLAC/stream_decoder.c, stream_encoder.c, and stream_encoder_framing.c. The decoder routine read_residual_partitioned_rice_() might be a good place to start. FLAC is highly modular code with lots of interfaces and abstraction layers; it takes lots of tracing to follow the flow and sort out the actual implementation. Keep at it though; it's good practice.> P.S. I totally appreciate the very clean code and documentation! It's > making the learning much less painful than I think it could be.Yes, Josh's code is well written, in a C++ sort of way. :-) Good luck and let us know if you get stuck, -r
I feel really silly asking this, but where is read_residual_partitioned_rice> > _() ? I tried using the standard find feature on text editors for all of > the .c and .cpp files in libFLAC and libFLAC++, but nothing came up.-Mary On 7/11/06, Ralph Giles <giles@xiph.org> wrote:> > On Tue, Jul 11, 2006 at 04:17:41PM -0700, Mary Amon wrote: > > > Right now, I am > > looking in the src code of libFLAC, (I am looking through > stream_encoder.c > > in libFLAC src code), but its really confusing to someone who just > learned > > what ./configure meant today. > > Well, configure is obfuscating, but that's not really the problem. > > You're on the right track; the rice encode/decode stuff is all > in libFLAC/stream_decoder.c, stream_encoder.c, and > stream_encoder_framing.c. The decoder routine > read_residual_partitioned_rice_() might be a good place to start. > > FLAC is highly modular code with lots of interfaces and abstraction > layers; it takes lots of tracing to follow the flow and sort out > the actual implementation. Keep at it though; it's good practice. > > > P.S. I totally appreciate the very clean code and documentation! It's > > making the learning much less painful than I think it could be. > > Yes, Josh's code is well written, in a C++ sort of way. :-) > > Good luck and let us know if you get stuck, > -r >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20060711/c8b1de3d/attachment.htm
--- Mary Amon <mary.amon@gmail.com> wrote:> Hi all, > > I am interested in building a stand alone Rice Encoder/Decoder, using > FLAC > source code as a starting point. I've read the theory behind it, and > I am > very interested in info theory. However, I am struggling with how > exactly > I would implement the theory in code. I'm a newbie to computer > science > (only 1 year experience). I have read the format and documentation > links on > the FLAC website, as well as the archives of the mailing list...and I > haven't found anyone doing something similar. I am new to doxygen > and have > never read or written anything as large as FLAC before. Right now, > I am > looking in the src code of libFLAC, (I am looking through > stream_encoder.c > in libFLAC src code), but its really confusing to someone who just > learned > what ./configure meant today. > > So any help in where I can find where the Rice encoder/decoder is > implemented in the code (in libFLAC or libFLAC++) would be super > helpful.hi Mary, the actual lowest level routines that write the value are in .../src/libFLAC/bitbuffer.c, they are FLAC__bitbuffer_write_rice_signed() FLAC__bitbuffer_read_rice_signed() there is a little terminology vagueness here, but FLAC's "rice" codes are probably not exactly "rice". usually rice codes (like in shorten) start with a sign bit and then have the magnitude encoded with the unary/binary part. since this wastes one of the shortest code words on minus-zero (which never occurs), FLAC first folds the signed number into unsigned like so: 0 -> 0 -1 -> 1 1 -> 2 -2 -> 3 2 -> 4 etc. and then codes the value without a sign bit. Josh __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com