} else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
if (s->maxval > 255)
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
+ } else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) {
+ if (s->maxval < 512)
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P9BE;
+ else if (s->maxval < 1024)
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P10BE;
+ else
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
} else {
av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
avctx->pix_fmt = AV_PIX_FMT_NONE;
}else
s->maxval=1;
/* more check if YUV420 */
- if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
+ 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);
}
return 0;
}
-
-av_cold int ff_pnm_end(AVCodecContext *avctx)
-{
- PNMContext *s = avctx->priv_data;
-
- if (s->picture.data[0])
- avctx->release_buffer(avctx, &s->picture);
-
- 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;
-}