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