diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
| commit | f7813a5324be39d13ab536c245d15dfc602a7849 (patch) | |
| tree | fad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/pnm.c | |
| parent | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff) | |
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/pnm.c')
| -rw-r--r-- | ffmpeg/libavcodec/pnm.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/ffmpeg/libavcodec/pnm.c b/ffmpeg/libavcodec/pnm.c index 33b8896..63b77cd 100644 --- a/ffmpeg/libavcodec/pnm.c +++ b/ffmpeg/libavcodec/pnm.c @@ -116,10 +116,10 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) if (depth == 1) { if (maxval == 1) { avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; - } else if (maxval == 255) { + } else if (maxval < 256) { avctx->pix_fmt = AV_PIX_FMT_GRAY8; } else { - avctx->pix_fmt = AV_PIX_FMT_GRAY16BE; + avctx->pix_fmt = AV_PIX_FMT_GRAY16; } } else if (depth == 2) { if (maxval == 255) @@ -128,13 +128,13 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) if (maxval < 256) { avctx->pix_fmt = AV_PIX_FMT_RGB24; } else { - avctx->pix_fmt = AV_PIX_FMT_RGB48BE; + avctx->pix_fmt = AV_PIX_FMT_RGB48; } } else if (depth == 4) { if (maxval < 256) { avctx->pix_fmt = AV_PIX_FMT_RGBA; } else { - avctx->pix_fmt = AV_PIX_FMT_RGBA64BE; + avctx->pix_fmt = AV_PIX_FMT_RGBA64; } } else { return AVERROR_INVALIDDATA; @@ -162,14 +162,14 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) } if (s->maxval >= 256) { if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) { - avctx->pix_fmt = AV_PIX_FMT_GRAY16BE; + avctx->pix_fmt = AV_PIX_FMT_GRAY16; } else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) { - avctx->pix_fmt = AV_PIX_FMT_RGB48BE; + avctx->pix_fmt = AV_PIX_FMT_RGB48; } else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) { if (s->maxval < 512) - avctx->pix_fmt = AV_PIX_FMT_YUV420P9BE; + avctx->pix_fmt = AV_PIX_FMT_YUV420P9; else if (s->maxval < 1024) - avctx->pix_fmt = AV_PIX_FMT_YUV420P10BE; + avctx->pix_fmt = AV_PIX_FMT_YUV420P10; else avctx->pix_fmt = AV_PIX_FMT_YUV420P16; } else { @@ -181,7 +181,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) }else s->maxval=1; /* more check if YUV420 */ - if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & PIX_FMT_PLANAR) { + if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR) { if ((avctx->width & 1) != 0) return AVERROR_INVALIDDATA; h = (avctx->height * 2); @@ -192,13 +192,3 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) } return 0; } - -av_cold int ff_pnm_init(AVCodecContext *avctx) -{ - PNMContext *s = avctx->priv_data; - - avcodec_get_frame_defaults(&s->picture); - avctx->coded_frame = &s->picture; - - return 0; -} |
