aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-14 05:39:03 +0000
committerMichael Niedermayer <michaelni@gmx.at>2012-02-15 00:41:40 +0100
commit83e2e9315aba64dddf98e8cb769d3d3643323007 (patch)
treebbdd5f168cfaf7b0c5fb2ebc2063b5d09a1f2d16 /libavcodec/ffv1.c
parentd3b06399ffbcd2e4b2eefcb2a953762fd0c87789 (diff)
downloadffmpeg-83e2e9315aba64dddf98e8cb769d3d3643323007.tar.gz
ffv1: PIX_FMT_GRAY8 support
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ffv1.c')
-rw-r--r--libavcodec/ffv1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index f483825063..48b8ae17e9 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -32,6 +32,7 @@
#include "rangecoder.h"
#include "golomb.h"
#include "mathops.h"
+#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
#define MAX_PLANES 4
@@ -902,13 +903,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
return -1;
}
s->version= FFMAX(s->version, 1);
+ case PIX_FMT_GRAY8:
case PIX_FMT_YUV444P:
case PIX_FMT_YUV440P:
case PIX_FMT_YUV422P:
case PIX_FMT_YUV420P:
case PIX_FMT_YUV411P:
case PIX_FMT_YUV410P:
- s->chroma_planes= avctx->pix_fmt == PIX_FMT_GRAY16 ? 0 : 1;
+ s->chroma_planes= av_pix_fmt_descriptors[avctx->pix_fmt].nb_components < 3 ? 0 : 1;
s->colorspace= 0;
break;
case PIX_FMT_YUVA444P:
@@ -1593,8 +1595,11 @@ static int read_header(FFV1Context *f){
}
if(f->colorspace==0){
- if(f->avctx->bits_per_raw_sample>8 && !f->transparency && !f->chroma_planes){
- f->avctx->pix_fmt= PIX_FMT_GRAY16;
+ if(!f->transparency && !f->chroma_planes){
+ if (f->avctx->bits_per_raw_sample<=8)
+ f->avctx->pix_fmt= PIX_FMT_GRAY8;
+ else
+ f->avctx->pix_fmt= PIX_FMT_GRAY16;
}else if(f->avctx->bits_per_raw_sample<=8 && !f->transparency){
switch(16*f->chroma_h_shift + f->chroma_v_shift){
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break;
@@ -1837,7 +1842,7 @@ AVCodec ff_ffv1_encoder = {
.encode = encode_frame,
.close = common_end,
.capabilities = CODEC_CAP_SLICE_THREADS,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUVA420P, PIX_FMT_YUV444P, PIX_FMT_YUVA444P, PIX_FMT_YUV440P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_0RGB32, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_YUV420P9, PIX_FMT_YUV420P10, PIX_FMT_YUV422P10, PIX_FMT_GRAY16, PIX_FMT_NONE},
+ .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUVA420P, PIX_FMT_YUV444P, PIX_FMT_YUVA444P, PIX_FMT_YUV440P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_0RGB32, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_YUV420P9, PIX_FMT_YUV420P10, PIX_FMT_YUV422P10, PIX_FMT_GRAY16, PIX_FMT_GRAY8, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
};
#endif