Mercurial > libavcodec.hg
annotate pnmenc.c @ 10459:a6bb56636f90 libavcodec
whitespace cosmetics: K&R coding style, prettyprinting
author | diego |
---|---|
date | Tue, 27 Oct 2009 16:57:35 +0000 |
parents | 511cbeb9fb4b |
children | 059265d3cc65 |
rev | line source |
---|---|
2344 | 1 /* |
2 * PNM image format | |
8629
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8590
diff
changeset
|
3 * Copyright (c) 2002, 2003 Fabrice Bellard |
2344 | 4 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3455
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3455
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3455
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
2344 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3455
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
2344 | 11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3455
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
2344 | 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 | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3455
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
2344 | 20 */ |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
21 |
2344 | 22 #include "avcodec.h" |
5089 | 23 #include "bytestream.h" |
4978 | 24 #include "pnm.h" |
2967 | 25 |
2344 | 26 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
27 static av_cold int common_init(AVCodecContext *avctx) |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
28 { |
2344 | 29 PNMContext *s = avctx->priv_data; |
30 | |
31 avcodec_get_frame_defaults((AVFrame*)&s->picture); | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
32 avctx->coded_frame = (AVFrame*)&s->picture; |
2344 | 33 |
34 return 0; | |
35 } | |
36 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
37 static int pnm_decode_frame(AVCodecContext *avctx, void *data, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
38 int *data_size, AVPacket *avpkt) |
2348 | 39 { |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
40 const uint8_t *buf = avpkt->data; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
41 int buf_size = avpkt->size; |
2348 | 42 PNMContext * const s = avctx->priv_data; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
43 AVFrame *picture = data; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
44 AVFrame * const p = (AVFrame*)&s->picture; |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
45 int i, n, linesize, h, upgrade = 0; |
2348 | 46 unsigned char *ptr; |
47 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
48 s->bytestream_start = |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
49 s->bytestream = buf; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
50 s->bytestream_end = buf + buf_size; |
2967 | 51 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
52 if (ff_pnm_decode_header(avctx, s) < 0) |
2349 | 53 return -1; |
2967 | 54 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
55 if (p->data[0]) |
2344 | 56 avctx->release_buffer(avctx, p); |
57 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
58 p->reference = 0; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
59 if (avctx->get_buffer(avctx, p) < 0) { |
2344 | 60 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
61 return -1; | |
62 } | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
63 p->pict_type = FF_I_TYPE; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
64 p->key_frame = 1; |
2967 | 65 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
66 switch (avctx->pix_fmt) { |
2344 | 67 default: |
68 return -1; | |
9002 | 69 case PIX_FMT_RGB48BE: |
70 n = avctx->width * 6; | |
71 goto do_read; | |
2344 | 72 case PIX_FMT_RGB24: |
73 n = avctx->width * 3; | |
74 goto do_read; | |
75 case PIX_FMT_GRAY8: | |
76 n = avctx->width; | |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
77 if (s->maxval < 255) |
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
78 upgrade = 1; |
2344 | 79 goto do_read; |
4068 | 80 case PIX_FMT_GRAY16BE: |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
81 case PIX_FMT_GRAY16LE: |
4068 | 82 n = avctx->width * 2; |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
83 if (s->maxval < 65535) |
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
84 upgrade = 2; |
4068 | 85 goto do_read; |
2344 | 86 case PIX_FMT_MONOWHITE: |
2349 | 87 case PIX_FMT_MONOBLACK: |
2344 | 88 n = (avctx->width + 7) >> 3; |
89 do_read: | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
90 ptr = p->data[0]; |
2344 | 91 linesize = p->linesize[0]; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
92 if (s->bytestream + n * avctx->height > s->bytestream_end) |
2839 | 93 return -1; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
94 for (i = 0; i < avctx->height; i++) { |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
95 if (!upgrade) |
4837 | 96 memcpy(ptr, s->bytestream, n); |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
97 else if (upgrade == 1) { |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
98 unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
99 for (j = 0; j < n; j++) |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
100 ptr[j] = (s->bytestream[j] * f + 64) >> 7; |
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
101 } else if (upgrade == 2) { |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
102 unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
103 for (j = 0; j < n / 2; j++) { |
4836
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
104 v = be2me_16(((uint16_t *)s->bytestream)[j]); |
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
105 ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15; |
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
106 } |
ae19d863073f
Add support for grayscale images with arbitrary maxvals.
ivo
parents:
4494
diff
changeset
|
107 } |
2344 | 108 s->bytestream += n; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
109 ptr += linesize; |
2344 | 110 } |
111 break; | |
112 case PIX_FMT_YUV420P: | |
113 { | |
114 unsigned char *ptr1, *ptr2; | |
115 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
116 n = avctx->width; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
117 ptr = p->data[0]; |
2344 | 118 linesize = p->linesize[0]; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
119 if (s->bytestream + n * avctx->height * 3 / 2 > s->bytestream_end) |
2839 | 120 return -1; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
121 for (i = 0; i < avctx->height; i++) { |
2344 | 122 memcpy(ptr, s->bytestream, n); |
123 s->bytestream += n; | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
124 ptr += linesize; |
2344 | 125 } |
126 ptr1 = p->data[1]; | |
127 ptr2 = p->data[2]; | |
128 n >>= 1; | |
129 h = avctx->height >> 1; | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
130 for (i = 0; i < h; i++) { |
2344 | 131 memcpy(ptr1, s->bytestream, n); |
132 s->bytestream += n; | |
133 memcpy(ptr2, s->bytestream, n); | |
134 s->bytestream += n; | |
135 ptr1 += p->linesize[1]; | |
136 ptr2 += p->linesize[2]; | |
137 } | |
138 } | |
139 break; | |
4494
ce643a22f049
Replace deprecated PIX_FMT names by the newer variants.
diego
parents:
4152
diff
changeset
|
140 case PIX_FMT_RGB32: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
141 ptr = p->data[0]; |
2349 | 142 linesize = p->linesize[0]; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
143 if (s->bytestream + avctx->width * avctx->height * 4 > s->bytestream_end) |
2839 | 144 return -1; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
145 for (i = 0; i < avctx->height; i++) { |
2349 | 146 int j, r, g, b, a; |
147 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
148 for (j = 0; j < avctx->width; j++) { |
2349 | 149 r = *s->bytestream++; |
150 g = *s->bytestream++; | |
151 b = *s->bytestream++; | |
152 a = *s->bytestream++; | |
153 ((uint32_t *)ptr)[j] = (a << 24) | (r << 16) | (g << 8) | b; | |
154 } | |
155 ptr += linesize; | |
156 } | |
157 break; | |
2344 | 158 } |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
159 *picture = *(AVFrame*)&s->picture; |
2344 | 160 *data_size = sizeof(AVPicture); |
161 | |
162 return s->bytestream - s->bytestream_start; | |
163 } | |
164 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
165 static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
166 int buf_size, void *data) |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
167 { |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
168 PNMContext *s = avctx->priv_data; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
169 AVFrame *pict = data; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
170 AVFrame * const p = (AVFrame*)&s->picture; |
2344 | 171 int i, h, h1, c, n, linesize; |
172 uint8_t *ptr, *ptr1, *ptr2; | |
173 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
174 if (buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200) { |
2422 | 175 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); |
176 return -1; | |
177 } | |
178 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
179 *p = *pict; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
180 p->pict_type = FF_I_TYPE; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
181 p->key_frame = 1; |
2967 | 182 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
183 s->bytestream_start = |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
184 s->bytestream = outbuf; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
185 s->bytestream_end = outbuf + buf_size; |
2344 | 186 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
187 h = avctx->height; |
2344 | 188 h1 = h; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
189 switch (avctx->pix_fmt) { |
2344 | 190 case PIX_FMT_MONOWHITE: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
191 c = '4'; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
192 n = (avctx->width + 7) >> 3; |
2344 | 193 break; |
194 case PIX_FMT_GRAY8: | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
195 c = '5'; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
196 n = avctx->width; |
2344 | 197 break; |
4068 | 198 case PIX_FMT_GRAY16BE: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
199 c = '5'; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
200 n = avctx->width * 2; |
4068 | 201 break; |
2344 | 202 case PIX_FMT_RGB24: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
203 c = '6'; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
204 n = avctx->width * 3; |
2344 | 205 break; |
9002 | 206 case PIX_FMT_RGB48BE: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
207 c = '6'; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
208 n = avctx->width * 6; |
9002 | 209 break; |
2344 | 210 case PIX_FMT_YUV420P: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
211 c = '5'; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
212 n = avctx->width; |
2344 | 213 h1 = (h * 3) / 2; |
214 break; | |
215 default: | |
216 return -1; | |
217 } | |
2967 | 218 snprintf(s->bytestream, s->bytestream_end - s->bytestream, |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
219 "P%c\n%d %d\n", c, avctx->width, h1); |
2344 | 220 s->bytestream += strlen(s->bytestream); |
221 if (avctx->pix_fmt != PIX_FMT_MONOWHITE) { | |
2967 | 222 snprintf(s->bytestream, s->bytestream_end - s->bytestream, |
9002 | 223 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535); |
2344 | 224 s->bytestream += strlen(s->bytestream); |
225 } | |
226 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
227 ptr = p->data[0]; |
2344 | 228 linesize = p->linesize[0]; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
229 for (i = 0; i < h; i++) { |
2344 | 230 memcpy(s->bytestream, ptr, n); |
231 s->bytestream += n; | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
232 ptr += linesize; |
2344 | 233 } |
2967 | 234 |
2344 | 235 if (avctx->pix_fmt == PIX_FMT_YUV420P) { |
236 h >>= 1; | |
237 n >>= 1; | |
238 ptr1 = p->data[1]; | |
239 ptr2 = p->data[2]; | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
240 for (i = 0; i < h; i++) { |
2344 | 241 memcpy(s->bytestream, ptr1, n); |
242 s->bytestream += n; | |
243 memcpy(s->bytestream, ptr2, n); | |
244 s->bytestream += n; | |
245 ptr1 += p->linesize[1]; | |
246 ptr2 += p->linesize[2]; | |
247 } | |
248 } | |
249 return s->bytestream - s->bytestream_start; | |
250 } | |
251 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
252 static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
253 int buf_size, void *data) |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
254 { |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
255 PNMContext *s = avctx->priv_data; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
256 AVFrame *pict = data; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
257 AVFrame * const p = (AVFrame*)&s->picture; |
2344 | 258 int i, h, w, n, linesize, depth, maxval; |
259 const char *tuple_type; | |
260 uint8_t *ptr; | |
261 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
262 if (buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200) { |
2422 | 263 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); |
264 return -1; | |
265 } | |
266 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
267 *p = *pict; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
268 p->pict_type = FF_I_TYPE; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
269 p->key_frame = 1; |
2967 | 270 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
271 s->bytestream_start = |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
272 s->bytestream = outbuf; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
273 s->bytestream_end = outbuf+buf_size; |
2344 | 274 |
275 h = avctx->height; | |
276 w = avctx->width; | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
277 switch (avctx->pix_fmt) { |
2344 | 278 case PIX_FMT_MONOWHITE: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
279 n = (w + 7) >> 3; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
280 depth = 1; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
281 maxval = 1; |
2344 | 282 tuple_type = "BLACKANDWHITE"; |
283 break; | |
284 case PIX_FMT_GRAY8: | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
285 n = w; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
286 depth = 1; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
287 maxval = 255; |
2344 | 288 tuple_type = "GRAYSCALE"; |
289 break; | |
290 case PIX_FMT_RGB24: | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
291 n = w * 3; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
292 depth = 3; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
293 maxval = 255; |
2344 | 294 tuple_type = "RGB"; |
295 break; | |
4494
ce643a22f049
Replace deprecated PIX_FMT names by the newer variants.
diego
parents:
4152
diff
changeset
|
296 case PIX_FMT_RGB32: |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
297 n = w * 4; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
298 depth = 4; |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
299 maxval = 255; |
2344 | 300 tuple_type = "RGB_ALPHA"; |
301 break; | |
302 default: | |
303 return -1; | |
304 } | |
2967 | 305 snprintf(s->bytestream, s->bytestream_end - s->bytestream, |
2344 | 306 "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLETYPE %s\nENDHDR\n", |
307 w, h, depth, maxval, tuple_type); | |
308 s->bytestream += strlen(s->bytestream); | |
2967 | 309 |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
310 ptr = p->data[0]; |
2344 | 311 linesize = p->linesize[0]; |
2967 | 312 |
4494
ce643a22f049
Replace deprecated PIX_FMT names by the newer variants.
diego
parents:
4152
diff
changeset
|
313 if (avctx->pix_fmt == PIX_FMT_RGB32) { |
2344 | 314 int j; |
315 unsigned int v; | |
316 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
317 for (i = 0; i < h; i++) { |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
318 for (j = 0; j < w; j++) { |
2344 | 319 v = ((uint32_t *)ptr)[j]; |
5089 | 320 bytestream_put_be24(&s->bytestream, v); |
2344 | 321 *s->bytestream++ = v >> 24; |
322 } | |
323 ptr += linesize; | |
324 } | |
325 } else { | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
326 for (i = 0; i < h; i++) { |
2344 | 327 memcpy(s->bytestream, ptr, n); |
328 s->bytestream += n; | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
329 ptr += linesize; |
2344 | 330 } |
331 } | |
332 return s->bytestream - s->bytestream_start; | |
333 } | |
334 | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
335 static av_cold int common_end(AVCodecContext *avctx) |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
336 { |
10412 | 337 PNMContext *s = avctx->priv_data; |
338 | |
339 if (s->picture.data[0]) | |
340 avctx->release_buffer(avctx, &s->picture); | |
341 | |
342 return 0; | |
343 } | |
344 | |
2348 | 345 |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
346 #if CONFIG_PGM_DECODER |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
347 AVCodec pgm_decoder = { |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
348 "pgm", |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
349 CODEC_TYPE_VIDEO, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
350 CODEC_ID_PGM, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
351 sizeof(PNMContext), |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
352 common_init, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
353 NULL, |
10412 | 354 common_end, |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
355 pnm_decode_frame, |
9801
7f15f8f14e97
pgm, pgmyuv, ppm, pbm and pam decoders use get_buffer, set CODEC_CAP_DR1
bcoudurier
parents:
9355
diff
changeset
|
356 CODEC_CAP_DR1, |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
357 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
358 .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
359 }; |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
360 #endif |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
361 |
8590 | 362 #if CONFIG_PGM_ENCODER |
2344 | 363 AVCodec pgm_encoder = { |
364 "pgm", | |
365 CODEC_TYPE_VIDEO, | |
366 CODEC_ID_PGM, | |
367 sizeof(PNMContext), | |
368 common_init, | |
369 pnm_encode_frame, | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
370 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
371 .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), |
2344 | 372 }; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
373 #endif |
2344 | 374 |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
375 #if CONFIG_PGMYUV_DECODER |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
376 AVCodec pgmyuv_decoder = { |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
377 "pgmyuv", |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
378 CODEC_TYPE_VIDEO, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
379 CODEC_ID_PGMYUV, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
380 sizeof(PNMContext), |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
381 common_init, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
382 NULL, |
10412 | 383 common_end, |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
384 pnm_decode_frame, |
9801
7f15f8f14e97
pgm, pgmyuv, ppm, pbm and pam decoders use get_buffer, set CODEC_CAP_DR1
bcoudurier
parents:
9355
diff
changeset
|
385 CODEC_CAP_DR1, |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
386 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
387 .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
388 }; |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
389 #endif |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
390 |
8590 | 391 #if CONFIG_PGMYUV_ENCODER |
2344 | 392 AVCodec pgmyuv_encoder = { |
393 "pgmyuv", | |
394 CODEC_TYPE_VIDEO, | |
395 CODEC_ID_PGMYUV, | |
396 sizeof(PNMContext), | |
397 common_init, | |
398 pnm_encode_frame, | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
399 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
400 .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), |
2344 | 401 }; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
402 #endif |
2344 | 403 |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
404 #if CONFIG_PPM_DECODER |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
405 AVCodec ppm_decoder = { |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
406 "ppm", |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
407 CODEC_TYPE_VIDEO, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
408 CODEC_ID_PPM, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
409 sizeof(PNMContext), |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
410 common_init, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
411 NULL, |
10412 | 412 common_end, |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
413 pnm_decode_frame, |
9801
7f15f8f14e97
pgm, pgmyuv, ppm, pbm and pam decoders use get_buffer, set CODEC_CAP_DR1
bcoudurier
parents:
9355
diff
changeset
|
414 CODEC_CAP_DR1, |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
415 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
416 .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
417 }; |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
418 #endif |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
419 |
8590 | 420 #if CONFIG_PPM_ENCODER |
2344 | 421 AVCodec ppm_encoder = { |
422 "ppm", | |
423 CODEC_TYPE_VIDEO, | |
424 CODEC_ID_PPM, | |
425 sizeof(PNMContext), | |
426 common_init, | |
427 pnm_encode_frame, | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
428 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
429 .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), |
2344 | 430 }; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
431 #endif |
2344 | 432 |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
433 #if CONFIG_PBM_DECODER |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
434 AVCodec pbm_decoder = { |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
435 "pbm", |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
436 CODEC_TYPE_VIDEO, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
437 CODEC_ID_PBM, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
438 sizeof(PNMContext), |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
439 common_init, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
440 NULL, |
10412 | 441 common_end, |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
442 pnm_decode_frame, |
9801
7f15f8f14e97
pgm, pgmyuv, ppm, pbm and pam decoders use get_buffer, set CODEC_CAP_DR1
bcoudurier
parents:
9355
diff
changeset
|
443 CODEC_CAP_DR1, |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
444 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
445 .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
446 }; |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
447 #endif |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
448 |
8590 | 449 #if CONFIG_PBM_ENCODER |
2344 | 450 AVCodec pbm_encoder = { |
451 "pbm", | |
452 CODEC_TYPE_VIDEO, | |
453 CODEC_ID_PBM, | |
454 sizeof(PNMContext), | |
455 common_init, | |
456 pnm_encode_frame, | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
457 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
458 .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), |
2344 | 459 }; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
460 #endif |
2344 | 461 |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
462 #if CONFIG_PAM_DECODER |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
463 AVCodec pam_decoder = { |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
464 "pam", |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
465 CODEC_TYPE_VIDEO, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
466 CODEC_ID_PAM, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
467 sizeof(PNMContext), |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
468 common_init, |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
469 NULL, |
10412 | 470 common_end, |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
471 pnm_decode_frame, |
9801
7f15f8f14e97
pgm, pgmyuv, ppm, pbm and pam decoders use get_buffer, set CODEC_CAP_DR1
bcoudurier
parents:
9355
diff
changeset
|
472 CODEC_CAP_DR1, |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
473 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
474 .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), |
9246
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
475 }; |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
476 #endif |
18b83dac1221
Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents:
9002
diff
changeset
|
477 |
8590 | 478 #if CONFIG_PAM_ENCODER |
2344 | 479 AVCodec pam_encoder = { |
480 "pam", | |
481 CODEC_TYPE_VIDEO, | |
482 CODEC_ID_PAM, | |
483 sizeof(PNMContext), | |
484 common_init, | |
485 pam_encode_frame, | |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
486 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE}, |
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
487 .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), |
2344 | 488 }; |
10459
a6bb56636f90
whitespace cosmetics: K&R coding style, prettyprinting
diego
parents:
10458
diff
changeset
|
489 #endif |