diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-12 17:27:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-12 17:35:30 +0200 |
commit | 7a3a2598400af165a235eb4c08afd78a44eb2601 (patch) | |
tree | 364daa8cc9f330006347abe444a9ed62323cde7d /libavcodec | |
parent | 518cdff81fff7bf0dac6aaa4b456fe90647acdea (diff) | |
download | ffmpeg-7a3a2598400af165a235eb4c08afd78a44eb2601.tar.gz |
ffv1dec: output PIX_FMT_YUV422P10 and PIX_FMT_YUV420P10 when possible.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ffv1.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index f832391f5f..1c613adbb6 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -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 ; |