[Ffmpeg-devel] [RFC] rtjpeg decoding functions
Michael Niedermayer
michaelni
Wed Jan 18 00:50:00 CET 2006
Hi
On Tue, Jan 17, 2006 at 09:03:11PM +0100, Reimar D?ffinger wrote:
> Hi,
> the attached patch constains (untested) rtjpeg decoding functions. These
> are _not_ in a decoder module, since I do not know of any pure rtjpeg
> codec, and nuv must select between different codings on a per-frame
> basis.
> Any comments or a "testbed" are welcome.
[...]
> + uint8_t dc = get_bits(gb, 8);
> +
> + // block not coded
> + if (dc == 255)
> + return 0;
> +
> + // number of non-zero coefficients
> + coeff = get_bits(gb, 6);
> + memset(&block[coeff + 1], 0, 63 - coeff);
> +
> + // 2 bits per coefficient
> + while (coeff) {
> + ac = get_sbits(gb, 2);
> + if (ac == -2)
> + break; // continue with more bits
> + PUT_COEFF(ac);
> + }
> +
> + // 4 bits per coefficient
> + align_get_bits_to(gb, 4);
> + while (coeff) {
> + ac = get_sbits(gb, 4);
> + if (ac == -8)
> + break; // continue with more bits
> + PUT_COEFF(ac);
> + }
> +
> + // 8 bits per coefficient
> + align_get_bits_to(gb, 8);
if all the 8bit codewords are 8bit aligned then the bitstream reader seems
a less then ideal way to read them, same for 4 and 2bit aligned stuff
[...]
--
Michael
More information about the ffmpeg-devel
mailing list