annotate pnmdec.c @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 8b28e74de2c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
1 /*
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
2 * PNM image format
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
3 * Copyright (c) 2002, 2003 Fabrice Bellard
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
4 *
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
5 * This file is part of FFmpeg.
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
6 *
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
11 *
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
15 * Lesser General Public License for more details.
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
16 *
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
20 */
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
21
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
22 #include "avcodec.h"
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
23 #include "bytestream.h"
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
24 #include "put_bits.h"
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
25 #include "pnm.h"
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
26
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
27
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
28 static int pnm_decode_frame(AVCodecContext *avctx, void *data,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
29 int *data_size, AVPacket *avpkt)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
30 {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
31 const uint8_t *buf = avpkt->data;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
32 int buf_size = avpkt->size;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
33 PNMContext * const s = avctx->priv_data;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
34 AVFrame *picture = data;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
35 AVFrame * const p = (AVFrame*)&s->picture;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
36 int i, j, n, linesize, h, upgrade = 0;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
37 unsigned char *ptr;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
38 int components, sample_len;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
39
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
40 s->bytestream_start =
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
41 s->bytestream = buf;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
42 s->bytestream_end = buf + buf_size;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
43
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
44 if (ff_pnm_decode_header(avctx, s) < 0)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
45 return -1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
46
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
47 if (p->data[0])
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
48 avctx->release_buffer(avctx, p);
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
49
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
50 p->reference = 0;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
51 if (avctx->get_buffer(avctx, p) < 0) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
52 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
53 return -1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
54 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
55 p->pict_type = FF_I_TYPE;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
56 p->key_frame = 1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
57
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
58 switch (avctx->pix_fmt) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
59 default:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
60 return -1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
61 case PIX_FMT_RGB48BE:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
62 n = avctx->width * 6;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
63 components=3;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
64 sample_len=16;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
65 goto do_read;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
66 case PIX_FMT_RGB24:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
67 n = avctx->width * 3;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
68 components=3;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
69 sample_len=8;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
70 goto do_read;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
71 case PIX_FMT_GRAY8:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
72 n = avctx->width;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
73 components=1;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
74 sample_len=8;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
75 if (s->maxval < 255)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
76 upgrade = 1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
77 goto do_read;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
78 case PIX_FMT_GRAY16BE:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
79 case PIX_FMT_GRAY16LE:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
80 n = avctx->width * 2;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
81 components=1;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
82 sample_len=16;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
83 if (s->maxval < 65535)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
84 upgrade = 2;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
85 goto do_read;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
86 case PIX_FMT_MONOWHITE:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
87 case PIX_FMT_MONOBLACK:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
88 n = (avctx->width + 7) >> 3;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
89 components=1;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
90 sample_len=1;
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
91 do_read:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
92 ptr = p->data[0];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
93 linesize = p->linesize[0];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
94 if (s->bytestream + n * avctx->height > s->bytestream_end)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
95 return -1;
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
96 if(s->type < 4){
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
97 for (i=0; i<avctx->height; i++) {
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
98 PutBitContext pb;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
99 init_put_bits(&pb, ptr, linesize);
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
100 for(j=0; j<avctx->width * components; j++){
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
101 unsigned int c=0;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
102 int v=0;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
103 while(s->bytestream < s->bytestream_end && (*s->bytestream < '0' || *s->bytestream > '9' ))
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
104 s->bytestream++;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
105 if(s->bytestream >= s->bytestream_end)
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
106 return -1;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
107 do{
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
108 v= 10*v + c;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
109 c= (*s->bytestream++) - '0';
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
110 }while(c <= 9);
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
111 put_bits(&pb, sample_len, (((1<<sample_len)-1)*v + (s->maxval>>1))/s->maxval);
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
112 }
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
113 flush_put_bits(&pb);
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
114 ptr+= linesize;
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
115 }
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
116 }else{
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
117 for (i = 0; i < avctx->height; i++) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
118 if (!upgrade)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
119 memcpy(ptr, s->bytestream, n);
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
120 else if (upgrade == 1) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
121 unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
122 for (j = 0; j < n; j++)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
123 ptr[j] = (s->bytestream[j] * f + 64) >> 7;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
124 } else if (upgrade == 2) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
125 unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
126 for (j = 0; j < n / 2; j++) {
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
127 v = av_be2ne16(((uint16_t *)s->bytestream)[j]);
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
128 ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
129 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
130 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
131 s->bytestream += n;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
132 ptr += linesize;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
133 }
10612
d6860312274c Support ASCII pnms.
michael
parents: 10465
diff changeset
134 }
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
135 break;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
136 case PIX_FMT_YUV420P:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
137 {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
138 unsigned char *ptr1, *ptr2;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
139
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
140 n = avctx->width;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
141 ptr = p->data[0];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
142 linesize = p->linesize[0];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
143 if (s->bytestream + n * avctx->height * 3 / 2 > s->bytestream_end)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
144 return -1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
145 for (i = 0; i < avctx->height; i++) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
146 memcpy(ptr, s->bytestream, n);
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
147 s->bytestream += n;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
148 ptr += linesize;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
149 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
150 ptr1 = p->data[1];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
151 ptr2 = p->data[2];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
152 n >>= 1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
153 h = avctx->height >> 1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
154 for (i = 0; i < h; i++) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
155 memcpy(ptr1, s->bytestream, n);
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
156 s->bytestream += n;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
157 memcpy(ptr2, s->bytestream, n);
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
158 s->bytestream += n;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
159 ptr1 += p->linesize[1];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
160 ptr2 += p->linesize[2];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
161 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
162 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
163 break;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
164 case PIX_FMT_RGB32:
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
165 ptr = p->data[0];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
166 linesize = p->linesize[0];
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
167 if (s->bytestream + avctx->width * avctx->height * 4 > s->bytestream_end)
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
168 return -1;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
169 for (i = 0; i < avctx->height; i++) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
170 int j, r, g, b, a;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
171
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
172 for (j = 0; j < avctx->width; j++) {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
173 r = *s->bytestream++;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
174 g = *s->bytestream++;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
175 b = *s->bytestream++;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
176 a = *s->bytestream++;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
177 ((uint32_t *)ptr)[j] = (a << 24) | (r << 16) | (g << 8) | b;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
178 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
179 ptr += linesize;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
180 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
181 break;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
182 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
183 *picture = *(AVFrame*)&s->picture;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
184 *data_size = sizeof(AVPicture);
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
185
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
186 return s->bytestream - s->bytestream_start;
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
187 }
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
188
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
189
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
190 #if CONFIG_PGM_DECODER
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
191 AVCodec pgm_decoder = {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
192 "pgm",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10612
diff changeset
193 AVMEDIA_TYPE_VIDEO,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
194 CODEC_ID_PGM,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
195 sizeof(PNMContext),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
196 ff_pnm_init,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
197 NULL,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
198 ff_pnm_end,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
199 pnm_decode_frame,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
200 CODEC_CAP_DR1,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
201 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
12108
c35d7bc64882 Add new decoder property max_lowres and do not init decoder if requested value is higher.
cehoyos
parents: 11560
diff changeset
202 .max_lowres = 5,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
203 .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
204 };
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
205 #endif
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
206
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
207 #if CONFIG_PGMYUV_DECODER
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
208 AVCodec pgmyuv_decoder = {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
209 "pgmyuv",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10612
diff changeset
210 AVMEDIA_TYPE_VIDEO,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
211 CODEC_ID_PGMYUV,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
212 sizeof(PNMContext),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
213 ff_pnm_init,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
214 NULL,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
215 ff_pnm_end,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
216 pnm_decode_frame,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
217 CODEC_CAP_DR1,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
218 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
12108
c35d7bc64882 Add new decoder property max_lowres and do not init decoder if requested value is higher.
cehoyos
parents: 11560
diff changeset
219 .max_lowres = 5,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
220 .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
221 };
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
222 #endif
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
223
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
224 #if CONFIG_PPM_DECODER
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
225 AVCodec ppm_decoder = {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
226 "ppm",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10612
diff changeset
227 AVMEDIA_TYPE_VIDEO,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
228 CODEC_ID_PPM,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
229 sizeof(PNMContext),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
230 ff_pnm_init,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
231 NULL,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
232 ff_pnm_end,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
233 pnm_decode_frame,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
234 CODEC_CAP_DR1,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
235 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
12108
c35d7bc64882 Add new decoder property max_lowres and do not init decoder if requested value is higher.
cehoyos
parents: 11560
diff changeset
236 .max_lowres = 5,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
237 .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
238 };
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
239 #endif
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
240
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
241 #if CONFIG_PBM_DECODER
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
242 AVCodec pbm_decoder = {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
243 "pbm",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10612
diff changeset
244 AVMEDIA_TYPE_VIDEO,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
245 CODEC_ID_PBM,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
246 sizeof(PNMContext),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
247 ff_pnm_init,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
248 NULL,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
249 ff_pnm_end,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
250 pnm_decode_frame,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
251 CODEC_CAP_DR1,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
252 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
12108
c35d7bc64882 Add new decoder property max_lowres and do not init decoder if requested value is higher.
cehoyos
parents: 11560
diff changeset
253 .max_lowres = 5,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
254 .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
255 };
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
256 #endif
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
257
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
258 #if CONFIG_PAM_DECODER
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
259 AVCodec pam_decoder = {
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
260 "pam",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10612
diff changeset
261 AVMEDIA_TYPE_VIDEO,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
262 CODEC_ID_PAM,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
263 sizeof(PNMContext),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
264 ff_pnm_init,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
265 NULL,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
266 ff_pnm_end,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
267 pnm_decode_frame,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
268 CODEC_CAP_DR1,
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
269 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
12108
c35d7bc64882 Add new decoder property max_lowres and do not init decoder if requested value is higher.
cehoyos
parents: 11560
diff changeset
270 .max_lowres = 5,
10465
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
271 .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
272 };
267588850827 Split the decoders from pnmen.c off into their own file.
diego
parents:
diff changeset
273 #endif