FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/pnmdec.c
Date: 2022-07-04 00:18:54
Exec Total Coverage
Lines: 151 303 49.8%
Branches: 67 152 44.1%

Line Branch Exec Source
1 /*
2 * PNM image format
3 * Copyright (c) 2002, 2003 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "config_components.h"
23
24 #include "avcodec.h"
25 #include "codec_internal.h"
26 #include "internal.h"
27 #include "put_bits.h"
28 #include "pnm.h"
29 #include "half2float.h"
30
31 6701872 static void samplecpy(uint8_t *dst, const uint8_t *src, int n, int maxval)
32 {
33
2/2
✓ Branch 0 taken 6693808 times.
✓ Branch 1 taken 8064 times.
6701872 if (maxval <= 255) {
34 6693808 memcpy(dst, src, n);
35 } else {
36 int i;
37
2/2
✓ Branch 0 taken 5677056 times.
✓ Branch 1 taken 8064 times.
5685120 for (i=0; i<n/2; i++) {
38 5677056 ((uint16_t *)dst)[i] = AV_RB16(src+2*i);
39 }
40 }
41 6701872 }
42
43 11823 static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
44 int *got_frame, AVPacket *avpkt)
45 {
46 11823 const uint8_t *buf = avpkt->data;
47 11823 int buf_size = avpkt->size;
48 11823 PNMContext * const s = avctx->priv_data;
49 11823 int i, j, k, n, linesize, h, upgrade = 0, is_mono = 0;
50 unsigned char *ptr;
51 int components, sample_len, ret;
52 float scale;
53
54 11823 s->bytestream_start =
55 11823 s->bytestream = (uint8_t *)buf;
56 11823 s->bytestream_end = (uint8_t *)buf + buf_size;
57
58
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11823 times.
11823 if ((ret = ff_pnm_decode_header(avctx, s)) < 0)
59 return ret;
60
61
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11823 times.
11823 if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
62 return ret;
63 11823 p->pict_type = AV_PICTURE_TYPE_I;
64 11823 p->key_frame = 1;
65 11823 avctx->bits_per_raw_sample = av_log2(s->maxval) + 1;
66
67
9/14
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 55 times.
✓ Branch 5 taken 173 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 39 times.
✓ Branch 10 taken 11458 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 28 times.
✓ Branch 13 taken 28 times.
11823 switch (avctx->pix_fmt) {
68 default:
69 return AVERROR(EINVAL);
70 case AV_PIX_FMT_RGBA64:
71 n = avctx->width * 8;
72 components=4;
73 sample_len=16;
74 if (s->maxval < 65535)
75 upgrade = 2;
76 goto do_read;
77 14 case AV_PIX_FMT_RGB48:
78 14 n = avctx->width * 6;
79 14 components=3;
80 14 sample_len=16;
81
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (s->maxval < 65535)
82 upgrade = 2;
83 14 goto do_read;
84 14 case AV_PIX_FMT_RGBA:
85 14 n = avctx->width * 4;
86 14 components=4;
87 14 sample_len=8;
88 14 goto do_read;
89 55 case AV_PIX_FMT_RGB24:
90 55 n = avctx->width * 3;
91 55 components=3;
92 55 sample_len=8;
93
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 55 times.
55 if (s->maxval < 255)
94 upgrade = 1;
95 55 goto do_read;
96 173 case AV_PIX_FMT_GRAY8:
97 173 n = avctx->width;
98 173 components=1;
99 173 sample_len=8;
100
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 173 times.
173 if (s->maxval < 255)
101 upgrade = 1;
102 173 goto do_read;
103 case AV_PIX_FMT_GRAY8A:
104 n = avctx->width * 2;
105 components=2;
106 sample_len=8;
107 goto do_read;
108 14 case AV_PIX_FMT_GRAY16:
109 14 n = avctx->width * 2;
110 14 components=1;
111 14 sample_len=16;
112
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (s->maxval < 65535)
113 upgrade = 2;
114 14 goto do_read;
115 case AV_PIX_FMT_YA16:
116 n = avctx->width * 4;
117 components=2;
118 sample_len=16;
119 if (s->maxval < 65535)
120 upgrade = 2;
121 goto do_read;
122 39 case AV_PIX_FMT_MONOWHITE:
123 case AV_PIX_FMT_MONOBLACK:
124 39 n = (avctx->width + 7) >> 3;
125 39 components=1;
126 39 sample_len=1;
127 39 is_mono = 1;
128 309 do_read:
129 309 ptr = p->data[0];
130 309 linesize = p->linesize[0];
131
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 309 times.
309 if (n * avctx->height > s->bytestream_end - s->bytestream)
132 return AVERROR_INVALIDDATA;
133
5/6
✓ Branch 0 taken 309 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✓ Branch 3 taken 270 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 25 times.
309 if(s->type < 4 || (is_mono && s->type==7)){
134
2/2
✓ Branch 0 taken 4032 times.
✓ Branch 1 taken 14 times.
4046 for (i=0; i<avctx->height; i++) {
135 PutBitContext pb;
136 4032 init_put_bits(&pb, ptr, linesize);
137
2/2
✓ Branch 0 taken 1419264 times.
✓ Branch 1 taken 4032 times.
1423296 for(j=0; j<avctx->width * components; j++){
138 1419264 unsigned int c=0;
139 1419264 unsigned v=0;
140
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1419264 times.
1419264 if(s->type < 4)
141 while(s->bytestream < s->bytestream_end && (*s->bytestream < '0' || *s->bytestream > '9' ))
142 s->bytestream++;
143
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1419264 times.
1419264 if(s->bytestream >= s->bytestream_end)
144 return AVERROR_INVALIDDATA;
145
1/2
✓ Branch 0 taken 1419264 times.
✗ Branch 1 not taken.
1419264 if (is_mono) {
146 /* read a single digit */
147 1419264 v = (*s->bytestream++)&1;
148 } else {
149 /* read a sequence of digits */
150 for (k = 0; k < 6 && c <= 9; k += 1) {
151 v = 10*v + c;
152 c = (*s->bytestream++) - '0';
153 }
154 if (v > s->maxval) {
155 av_log(avctx, AV_LOG_ERROR, "value %d larger than maxval %d\n", v, s->maxval);
156 return AVERROR_INVALIDDATA;
157 }
158 }
159
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1419264 times.
1419264 if (sample_len == 16) {
160 ((uint16_t*)ptr)[j] = (((1<<sample_len)-1)*v + (s->maxval>>1))/s->maxval;
161 } else
162 1419264 put_bits(&pb, sample_len, (((1<<sample_len)-1)*v + (s->maxval>>1))/s->maxval);
163 }
164
1/2
✓ Branch 0 taken 4032 times.
✗ Branch 1 not taken.
4032 if (sample_len != 16)
165 4032 flush_put_bits(&pb);
166 4032 ptr+= linesize;
167 }
168 }else{
169
2/2
✓ Branch 0 taken 102064 times.
✓ Branch 1 taken 295 times.
102359 for (i = 0; i < avctx->height; i++) {
170
1/2
✓ Branch 0 taken 102064 times.
✗ Branch 1 not taken.
102064 if (!upgrade)
171 102064 samplecpy(ptr, s->bytestream, n, s->maxval);
172 else if (upgrade == 1) {
173 unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval;
174 for (j = 0; j < n; j++)
175 ptr[j] = (s->bytestream[j] * f + 64) >> 7;
176 } else if (upgrade == 2) {
177 unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval;
178 for (j = 0; j < n / 2; j++) {
179 v = AV_RB16(s->bytestream + 2*j);
180 ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
181 }
182 }
183 102064 s->bytestream += n;
184 102064 ptr += linesize;
185 }
186 }
187 309 break;
188 11458 case AV_PIX_FMT_YUV420P:
189 case AV_PIX_FMT_YUV420P9:
190 case AV_PIX_FMT_YUV420P10:
191 {
192 unsigned char *ptr1, *ptr2;
193
194 11458 n = avctx->width;
195 11458 ptr = p->data[0];
196 11458 linesize = p->linesize[0];
197
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11458 times.
11458 if (s->maxval >= 256)
198 n *= 2;
199
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11458 times.
11458 if (n * avctx->height * 3 / 2 > s->bytestream_end - s->bytestream)
200 return AVERROR_INVALIDDATA;
201
2/2
✓ Branch 0 taken 3299904 times.
✓ Branch 1 taken 11458 times.
3311362 for (i = 0; i < avctx->height; i++) {
202 3299904 samplecpy(ptr, s->bytestream, n, s->maxval);
203 3299904 s->bytestream += n;
204 3299904 ptr += linesize;
205 }
206 11458 ptr1 = p->data[1];
207 11458 ptr2 = p->data[2];
208 11458 n >>= 1;
209 11458 h = avctx->height >> 1;
210
2/2
✓ Branch 0 taken 1649952 times.
✓ Branch 1 taken 11458 times.
1661410 for (i = 0; i < h; i++) {
211 1649952 samplecpy(ptr1, s->bytestream, n, s->maxval);
212 1649952 s->bytestream += n;
213 1649952 samplecpy(ptr2, s->bytestream, n, s->maxval);
214 1649952 s->bytestream += n;
215 1649952 ptr1 += p->linesize[1];
216 1649952 ptr2 += p->linesize[2];
217 }
218 }
219 11458 break;
220 case AV_PIX_FMT_YUV420P16:
221 {
222 uint16_t *ptr1, *ptr2;
223 const int f = (65535 * 32768 + s->maxval / 2) / s->maxval;
224 unsigned int j, v;
225
226 n = avctx->width * 2;
227 ptr = p->data[0];
228 linesize = p->linesize[0];
229 if (n * avctx->height * 3 / 2 > s->bytestream_end - s->bytestream)
230 return AVERROR_INVALIDDATA;
231 for (i = 0; i < avctx->height; i++) {
232 for (j = 0; j < n / 2; j++) {
233 v = AV_RB16(s->bytestream + 2*j);
234 ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
235 }
236 s->bytestream += n;
237 ptr += linesize;
238 }
239 ptr1 = (uint16_t*)p->data[1];
240 ptr2 = (uint16_t*)p->data[2];
241 n >>= 1;
242 h = avctx->height >> 1;
243 for (i = 0; i < h; i++) {
244 for (j = 0; j < n / 2; j++) {
245 v = AV_RB16(s->bytestream + 2*j);
246 ptr1[j] = (v * f + 16384) >> 15;
247 }
248 s->bytestream += n;
249
250 for (j = 0; j < n / 2; j++) {
251 v = AV_RB16(s->bytestream + 2*j);
252 ptr2[j] = (v * f + 16384) >> 15;
253 }
254 s->bytestream += n;
255
256 ptr1 += p->linesize[1] / 2;
257 ptr2 += p->linesize[2] / 2;
258 }
259 }
260 break;
261 28 case AV_PIX_FMT_GBRPF32:
262
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 if (!s->half) {
263
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
28 if (avctx->width * avctx->height * 12 > s->bytestream_end - s->bytestream)
264 return AVERROR_INVALIDDATA;
265 28 scale = 1.f / s->scale;
266
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 14 times.
28 if (s->endian) {
267 float *r, *g, *b;
268
269 14 r = (float *)p->data[2];
270 14 g = (float *)p->data[0];
271 14 b = (float *)p->data[1];
272
2/2
✓ Branch 0 taken 4032 times.
✓ Branch 1 taken 14 times.
4046 for (int i = 0; i < avctx->height; i++) {
273
2/2
✓ Branch 0 taken 1419264 times.
✓ Branch 1 taken 4032 times.
1423296 for (int j = 0; j < avctx->width; j++) {
274 1419264 r[j] = av_int2float(AV_RL32(s->bytestream+0)) * scale;
275 1419264 g[j] = av_int2float(AV_RL32(s->bytestream+4)) * scale;
276 1419264 b[j] = av_int2float(AV_RL32(s->bytestream+8)) * scale;
277 1419264 s->bytestream += 12;
278 }
279
280 4032 r += p->linesize[2] / 4;
281 4032 g += p->linesize[0] / 4;
282 4032 b += p->linesize[1] / 4;
283 }
284 } else {
285 float *r, *g, *b;
286
287 14 r = (float *)p->data[2];
288 14 g = (float *)p->data[0];
289 14 b = (float *)p->data[1];
290
2/2
✓ Branch 0 taken 4032 times.
✓ Branch 1 taken 14 times.
4046 for (int i = 0; i < avctx->height; i++) {
291
2/2
✓ Branch 0 taken 1419264 times.
✓ Branch 1 taken 4032 times.
1423296 for (int j = 0; j < avctx->width; j++) {
292 1419264 r[j] = av_int2float(AV_RB32(s->bytestream+0)) * scale;
293 1419264 g[j] = av_int2float(AV_RB32(s->bytestream+4)) * scale;
294 1419264 b[j] = av_int2float(AV_RB32(s->bytestream+8)) * scale;
295 1419264 s->bytestream += 12;
296 }
297
298 4032 r += p->linesize[2] / 4;
299 4032 g += p->linesize[0] / 4;
300 4032 b += p->linesize[1] / 4;
301 }
302 }
303 } else {
304 if (avctx->width * avctx->height * 6 > s->bytestream_end - s->bytestream)
305 return AVERROR_INVALIDDATA;
306 scale = 1.f / s->scale;
307 if (s->endian) {
308 float *r, *g, *b;
309
310 r = (float *)p->data[2];
311 g = (float *)p->data[0];
312 b = (float *)p->data[1];
313 for (int i = 0; i < avctx->height; i++) {
314 for (int j = 0; j < avctx->width; j++) {
315 r[j] = av_int2float(half2float(AV_RL16(s->bytestream+0),
316 s->mantissatable,
317 s->exponenttable,
318 s->offsettable)) * scale;
319 g[j] = av_int2float(half2float(AV_RL16(s->bytestream+2),
320 s->mantissatable,
321 s->exponenttable,
322 s->offsettable)) * scale;
323 b[j] = av_int2float(half2float(AV_RL16(s->bytestream+4),
324 s->mantissatable,
325 s->exponenttable,
326 s->offsettable)) * scale;
327 s->bytestream += 6;
328 }
329
330 r += p->linesize[2] / 4;
331 g += p->linesize[0] / 4;
332 b += p->linesize[1] / 4;
333 }
334 } else {
335 float *r, *g, *b;
336
337 r = (float *)p->data[2];
338 g = (float *)p->data[0];
339 b = (float *)p->data[1];
340 for (int i = 0; i < avctx->height; i++) {
341 for (int j = 0; j < avctx->width; j++) {
342 r[j] = av_int2float(half2float(AV_RB16(s->bytestream+0),
343 s->mantissatable,
344 s->exponenttable,
345 s->offsettable)) * scale;
346 g[j] = av_int2float(half2float(AV_RB16(s->bytestream+2),
347 s->mantissatable,
348 s->exponenttable,
349 s->offsettable)) * scale;
350 b[j] = av_int2float(half2float(AV_RB16(s->bytestream+4),
351 s->mantissatable,
352 s->exponenttable,
353 s->offsettable)) * scale;
354 s->bytestream += 6;
355 }
356
357 r += p->linesize[2] / 4;
358 g += p->linesize[0] / 4;
359 b += p->linesize[1] / 4;
360 }
361 } }
362 28 break;
363 28 case AV_PIX_FMT_GRAYF32:
364
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 if (!s->half) {
365
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
28 if (avctx->width * avctx->height * 4 > s->bytestream_end - s->bytestream)
366 return AVERROR_INVALIDDATA;
367 28 scale = 1.f / s->scale;
368
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 14 times.
28 if (s->endian) {
369 14 float *g = (float *)p->data[0];
370
2/2
✓ Branch 0 taken 4032 times.
✓ Branch 1 taken 14 times.
4046 for (int i = 0; i < avctx->height; i++) {
371
2/2
✓ Branch 0 taken 1419264 times.
✓ Branch 1 taken 4032 times.
1423296 for (int j = 0; j < avctx->width; j++) {
372 1419264 g[j] = av_int2float(AV_RL32(s->bytestream)) * scale;
373 1419264 s->bytestream += 4;
374 }
375 4032 g += p->linesize[0] / 4;
376 }
377 } else {
378 14 float *g = (float *)p->data[0];
379
2/2
✓ Branch 0 taken 4032 times.
✓ Branch 1 taken 14 times.
4046 for (int i = 0; i < avctx->height; i++) {
380
2/2
✓ Branch 0 taken 1419264 times.
✓ Branch 1 taken 4032 times.
1423296 for (int j = 0; j < avctx->width; j++) {
381 1419264 g[j] = av_int2float(AV_RB32(s->bytestream)) * scale;
382 1419264 s->bytestream += 4;
383 }
384 4032 g += p->linesize[0] / 4;
385 }
386 }
387 } else {
388 if (avctx->width * avctx->height * 2 > s->bytestream_end - s->bytestream)
389 return AVERROR_INVALIDDATA;
390 scale = 1.f / s->scale;
391 if (s->endian) {
392 float *g = (float *)p->data[0];
393 for (int i = 0; i < avctx->height; i++) {
394 for (int j = 0; j < avctx->width; j++) {
395 g[j] = av_int2float(half2float(AV_RL16(s->bytestream),
396 s->mantissatable,
397 s->exponenttable,
398 s->offsettable)) * scale;
399 s->bytestream += 2;
400 }
401 g += p->linesize[0] / 4;
402 }
403 } else {
404 float *g = (float *)p->data[0];
405 for (int i = 0; i < avctx->height; i++) {
406 for (int j = 0; j < avctx->width; j++) {
407 g[j] = av_int2float(half2float(AV_RB16(s->bytestream),
408 s->mantissatable,
409 s->exponenttable,
410 s->offsettable)) * scale;
411 s->bytestream += 2;
412 }
413 g += p->linesize[0] / 4;
414 }
415 }
416 }
417 28 break;
418 }
419 11823 *got_frame = 1;
420
421 11823 return s->bytestream - s->bytestream_start;
422 }
423
424
425 #if CONFIG_PGM_DECODER
426 const FFCodec ff_pgm_decoder = {
427 .p.name = "pgm",
428 .p.long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
429 .p.type = AVMEDIA_TYPE_VIDEO,
430 .p.id = AV_CODEC_ID_PGM,
431 .p.capabilities = AV_CODEC_CAP_DR1,
432 .priv_data_size = sizeof(PNMContext),
433 FF_CODEC_DECODE_CB(pnm_decode_frame),
434 };
435 #endif
436
437 #if CONFIG_PGMYUV_DECODER
438 const FFCodec ff_pgmyuv_decoder = {
439 .p.name = "pgmyuv",
440 .p.long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
441 .p.type = AVMEDIA_TYPE_VIDEO,
442 .p.id = AV_CODEC_ID_PGMYUV,
443 .p.capabilities = AV_CODEC_CAP_DR1,
444 .priv_data_size = sizeof(PNMContext),
445 FF_CODEC_DECODE_CB(pnm_decode_frame),
446 };
447 #endif
448
449 #if CONFIG_PPM_DECODER
450 const FFCodec ff_ppm_decoder = {
451 .p.name = "ppm",
452 .p.long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
453 .p.type = AVMEDIA_TYPE_VIDEO,
454 .p.id = AV_CODEC_ID_PPM,
455 .p.capabilities = AV_CODEC_CAP_DR1,
456 .priv_data_size = sizeof(PNMContext),
457 FF_CODEC_DECODE_CB(pnm_decode_frame),
458 };
459 #endif
460
461 #if CONFIG_PBM_DECODER
462 const FFCodec ff_pbm_decoder = {
463 .p.name = "pbm",
464 .p.long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
465 .p.type = AVMEDIA_TYPE_VIDEO,
466 .p.id = AV_CODEC_ID_PBM,
467 .p.capabilities = AV_CODEC_CAP_DR1,
468 .priv_data_size = sizeof(PNMContext),
469 FF_CODEC_DECODE_CB(pnm_decode_frame),
470 };
471 #endif
472
473 #if CONFIG_PAM_DECODER
474 const FFCodec ff_pam_decoder = {
475 .p.name = "pam",
476 .p.long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
477 .p.type = AVMEDIA_TYPE_VIDEO,
478 .p.id = AV_CODEC_ID_PAM,
479 .p.capabilities = AV_CODEC_CAP_DR1,
480 .priv_data_size = sizeof(PNMContext),
481 FF_CODEC_DECODE_CB(pnm_decode_frame),
482 };
483 #endif
484
485 #if CONFIG_PFM_DECODER
486 const FFCodec ff_pfm_decoder = {
487 .p.name = "pfm",
488 .p.long_name = NULL_IF_CONFIG_SMALL("PFM (Portable FloatMap) image"),
489 .p.type = AVMEDIA_TYPE_VIDEO,
490 .p.id = AV_CODEC_ID_PFM,
491 .p.capabilities = AV_CODEC_CAP_DR1,
492 .priv_data_size = sizeof(PNMContext),
493 FF_CODEC_DECODE_CB(pnm_decode_frame),
494 };
495 #endif
496
497 #if CONFIG_PHM_DECODER
498 static av_cold int phm_dec_init(AVCodecContext *avctx)
499 {
500 PNMContext *s = avctx->priv_data;
501
502 half2float_table(s->mantissatable, s->exponenttable, s->offsettable);
503
504 return 0;
505 }
506
507 const FFCodec ff_phm_decoder = {
508 .p.name = "phm",
509 .p.long_name = NULL_IF_CONFIG_SMALL("PHM (Portable HalfFloatMap) image"),
510 .p.type = AVMEDIA_TYPE_VIDEO,
511 .p.id = AV_CODEC_ID_PHM,
512 .p.capabilities = AV_CODEC_CAP_DR1,
513 .priv_data_size = sizeof(PNMContext),
514 .init = phm_dec_init,
515 FF_CODEC_DECODE_CB(pnm_decode_frame),
516 };
517 #endif
518