ffv1dec: output PIX_FMT_YUV422P10 and PIX_FMT_YUV420P10 when possible.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-05-12 17:27:31 +02:00
parent 518cdff81f
commit 7a3a259840
1 changed files with 19 additions and 3 deletions

View File

@ -1402,8 +1402,14 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
}
}else{
decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
for(x=0; x<w; x++){
((uint16_t*)(src + stride*y))[x]= sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
if(s->packed_at_lsb){
for(x=0; x<w; x++){
((uint16_t*)(src + stride*y))[x]= sample[1][x];
}
}else{
for(x=0; x<w; x++){
((uint16_t*)(src + stride*y))[x]= sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
}
}
}
//STOP_TIMER("decode-line")}
@ -1618,7 +1624,16 @@ static int read_header(FFV1Context *f){
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
}else{
}else if(f->avctx->bits_per_raw_sample==10) {
switch(16*f->chroma_h_shift + f->chroma_v_shift){
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P10; f->packed_at_lsb=1; break;
case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P10; f->packed_at_lsb=1; break;
default:
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
}else {
switch(16*f->chroma_h_shift + f->chroma_v_shift){
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P16; break;
@ -1655,6 +1670,7 @@ static int read_header(FFV1Context *f){
for(j=0; j<f->slice_count; j++){
FFV1Context *fs= f->slice_context[j];
fs->ac= f->ac;
fs->packed_at_lsb= f->packed_at_lsb;
if(f->version >= 2){
fs->slice_x = get_symbol(c, state, 0) *f->width ;