77 int compressed, xmin, ymin, xmax, ymax;
79 unsigned int w,
h, bits_per_pixel, bytes_per_line, nplanes, y, x,
81 uint8_t *ptr, *scanline;
91 if (bytestream2_get_byteu(&gb) != 0x0a || bytestream2_get_byteu(&gb) > 5) {
96 compressed = bytestream2_get_byteu(&gb);
97 bits_per_pixel = bytestream2_get_byteu(&gb);
98 xmin = bytestream2_get_le16u(&gb);
99 ymin = bytestream2_get_le16u(&gb);
100 xmax = bytestream2_get_le16u(&gb);
101 ymax = bytestream2_get_le16u(&gb);
105 if (xmax < xmin || ymax < ymin) {
114 nplanes = bytestream2_get_byteu(&gb);
115 bytes_per_line = bytestream2_get_le16u(&gb);
116 bytes_per_scanline = nplanes * bytes_per_line;
118 if (bytes_per_scanline < (
w * bits_per_pixel * nplanes + 7) / 8 ||
124 switch ((nplanes << 8) + bits_per_pixel) {
159 if (nplanes == 3 && bits_per_pixel == 8) {
160 for (y = 0; y <
h; y++) {
161 ret =
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
165 for (x = 0; x <
w; x++) {
166 ptr[3 * x] = scanline[x];
167 ptr[3 * x + 1] = scanline[x + bytes_per_line];
168 ptr[3 * x + 2] = scanline[x + (bytes_per_line << 1)];
173 }
else if (nplanes == 1 && bits_per_pixel == 8) {
174 int palstart = avpkt->
size - 769;
176 if (avpkt->
size < 769) {
183 for (y = 0; y <
h; y++, ptr +=
stride) {
184 ret =
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
187 memcpy(ptr, scanline,
w);
194 if (bytestream2_get_byte(&gb) != 12) {
200 }
else if (nplanes == 1) {
203 for (y = 0; y <
h; y++) {
206 ret =
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
210 for (x = 0; x <
w; x++)
217 for (y = 0; y <
h; y++) {
218 ret =
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
222 for (x = 0; x <
w; x++) {
223 int m = 0x80 >> (x & 7), v = 0;
224 for (
i = nplanes - 1;
i >= 0;
i--) {
226 v += !!(scanline[
i * bytes_per_line + (x >> 3)] & m);
235 if (nplanes == 1 && bits_per_pixel == 8) {
238 }
else if (bits_per_pixel * nplanes == 1) {
241 }
else if (bits_per_pixel < 8) {
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.