pcx: Convert to the new bitstream reader

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Alexandra Hájková 2016-04-12 18:32:50 +02:00 committed by Anton Khirnov
parent b3441350fa
commit 770406d1e8

View File

@ -23,9 +23,10 @@
*/ */
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "avcodec.h" #include "avcodec.h"
#include "bitstream.h"
#include "bytestream.h" #include "bytestream.h"
#include "get_bits.h"
#include "internal.h" #include "internal.h"
#define PCX_HEADER_SIZE 128 #define PCX_HEADER_SIZE 128
@ -179,15 +180,15 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
goto end; goto end;
} }
} else if (nplanes == 1) { /* all packed formats, max. 16 colors */ } else if (nplanes == 1) { /* all packed formats, max. 16 colors */
GetBitContext s; BitstreamContext s;
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
init_get_bits(&s, scanline, bytes_per_scanline << 3); bitstream_init(&s, scanline, bytes_per_scanline << 3);
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed); pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
ptr[x] = get_bits(&s, bits_per_pixel); ptr[x] = bitstream_read(&s, bits_per_pixel);
ptr += stride; ptr += stride;
} }
} else { /* planar, 4, 8 or 16 colors */ } else { /* planar, 4, 8 or 16 colors */