ffv1enc: support PIX_FMT_YUV420P10 & PIX_FMT_YUV422P10
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
74bf9d6231
commit
b0e1d0d9ee
@ -252,6 +252,7 @@ typedef struct FFV1Context{
|
|||||||
int colorspace;
|
int colorspace;
|
||||||
int_fast16_t *sample_buffer;
|
int_fast16_t *sample_buffer;
|
||||||
int gob_count;
|
int gob_count;
|
||||||
|
int packed_at_lsb;
|
||||||
|
|
||||||
int quant_table_count;
|
int quant_table_count;
|
||||||
|
|
||||||
@ -608,10 +609,16 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
|
|||||||
sample[0][x]= src[x + stride*y];
|
sample[0][x]= src[x + stride*y];
|
||||||
}
|
}
|
||||||
encode_line(s, w, sample, plane_index, 8);
|
encode_line(s, w, sample, plane_index, 8);
|
||||||
|
}else{
|
||||||
|
if(s->packed_at_lsb){
|
||||||
|
for(x=0; x<w; x++){
|
||||||
|
sample[0][x]= ((uint16_t*)(src + stride*y))[x];
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
for(x=0; x<w; x++){
|
for(x=0; x<w; x++){
|
||||||
sample[0][x]= ((uint16_t*)(src + stride*y))[x] >> (16 - s->avctx->bits_per_raw_sample);
|
sample[0][x]= ((uint16_t*)(src + stride*y))[x] >> (16 - s->avctx->bits_per_raw_sample);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
encode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
|
encode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
|
||||||
}
|
}
|
||||||
//STOP_TIMER("encode line")}
|
//STOP_TIMER("encode line")}
|
||||||
@ -966,6 +973,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
avctx->coded_frame= &s->picture;
|
avctx->coded_frame= &s->picture;
|
||||||
switch(avctx->pix_fmt){
|
switch(avctx->pix_fmt){
|
||||||
|
case PIX_FMT_YUV420P10:
|
||||||
|
case PIX_FMT_YUV422P10:
|
||||||
|
s->packed_at_lsb = 1;
|
||||||
case PIX_FMT_YUV444P16:
|
case PIX_FMT_YUV444P16:
|
||||||
case PIX_FMT_YUV422P16:
|
case PIX_FMT_YUV422P16:
|
||||||
case PIX_FMT_YUV420P16:
|
case PIX_FMT_YUV420P16:
|
||||||
@ -1812,7 +1822,7 @@ AVCodec ff_ffv1_encoder = {
|
|||||||
encode_frame,
|
encode_frame,
|
||||||
common_end,
|
common_end,
|
||||||
.capabilities = CODEC_CAP_SLICE_THREADS,
|
.capabilities = CODEC_CAP_SLICE_THREADS,
|
||||||
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE},
|
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_YUV420P10, PIX_FMT_YUV422P10, PIX_FMT_NONE},
|
||||||
.long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
|
.long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user