png: Support rgb48 and rgba64 encoding

This commit is contained in:
Carl Eugen Hoyos 2012-01-15 22:04:25 +00:00 committed by Vittorio Giovara
parent c598b569fb
commit cccac7654f
1 changed files with 9 additions and 1 deletions

View File

@ -245,6 +245,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
is_progressive = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
switch (avctx->pix_fmt) {
case AV_PIX_FMT_RGBA64BE:
bit_depth = 16;
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
break;
case AV_PIX_FMT_RGB48BE:
bit_depth = 16;
color_type = PNG_COLOR_TYPE_RGB;
break;
case AV_PIX_FMT_RGB32:
bit_depth = 8;
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
@ -482,7 +490,7 @@ AVCodec ff_png_encoder = {
.encode2 = encode_frame,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB32, AV_PIX_FMT_PAL8, AV_PIX_FMT_GRAY8,
AV_PIX_FMT_GRAY16BE,
AV_PIX_FMT_RGBA64BE, AV_PIX_FMT_RGB48BE, AV_PIX_FMT_GRAY16BE,
AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_NONE
},
};