#include "rangecoder.h"
#include "golomb.h"
#include "mathops.h"
+#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
#define MAX_PLANES 4
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:
}
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;
.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