1 /*
2 * Alias PIX image decoder
3 * Copyright (C) 2014 Vittorio Giovara <vittorio.giovara@gmail.com>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
23
27
28 #define ALIAS_HEADER_SIZE 10
29
32 {
39
41
45 }
46
47 width = bytestream2_get_be16u(&gb);
48 height = bytestream2_get_be16u(&gb);
50 bits_pixel = bytestream2_get_be16u(&gb);
51
52 if (bits_pixel == 24)
54 else if (bits_pixel == 8)
56 else {
59 }
60
62 if (ret < 0)
64
66 if (ret < 0)
68
71
72 x = 0;
73 y = 1;
76 int i;
77
78 /* set buffer at the right position at every new line */
79 if (x == avctx->
width) {
80 x = 0;
84 "Ended frame decoding with %d bytes left.\n",
87 }
88 }
89
90 /* read packet and copy data */
91 count = bytestream2_get_byteu(&gb);
92 if (!count || x + count > avctx->
width) {
95 }
96
98 pixel = bytestream2_get_be24(&gb);
99 for (i = 0; i <
count; i++) {
101 out_buf += 3;
102 }
103 } else { // AV_PIX_FMT_GRAY8
104 pixel = bytestream2_get_byte(&gb);
105 for (i = 0; i <
count; i++)
106 *out_buf++ = pixel;
107 }
108
109 x += i;
110 }
111
112 if (x != width || y != height) {
115 }
116
117 *got_frame = 1;
119 }
120
128 };