diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-10 13:37:36 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-10 13:38:36 +0400 |
commit | 70025c07a70334756b429f2892ee9ee9bbec119f (patch) | |
tree | c814a2c50499f96a5d8c9fffe26d497e6896b2e0 /libavcodec/vp6.c | |
parent | 5fcd0a80a25deb4b0a59779dd00ee0f6b0312e6b (diff) | |
parent | 41a10f3ba149a2012de499d0b4ad4955d81f28d5 (diff) |
Merge commit '41a10f3ba149a2012de499d0b4ad4955d81f28d5'
* commit '41a10f3ba149a2012de499d0b4ad4955d81f28d5':
vp6: Support cropping to AVCodecContext.width/height
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vp6.c')
-rw-r--r-- | libavcodec/vp6.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index 79b9cfebef..4cf11eea7e 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -83,10 +83,20 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) if (!s->macroblocks || /* first frame */ 16*cols != s->avctx->coded_width || 16*rows != s->avctx->coded_height) { - avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); - if (s->avctx->extradata_size == 1) { - s->avctx->width -= s->avctx->extradata[0] >> 4; - s->avctx->height -= s->avctx->extradata[0] & 0x0F; + if (s->avctx->extradata_size == 0 && + FFALIGN(s->avctx->width, 16) == 16 * cols && + FFALIGN(s->avctx->height, 16) == 16 * rows) { + // We assume this is properly signalled container cropping, + // in an F4V file. Just set the coded_width/height, don't + // touch the cropped ones. + s->avctx->coded_width = 16 * cols; + s->avctx->coded_height = 16 * rows; + } else { + avcodec_set_dimensions(s->avctx, 16 * cols, 16 * rows); + if (s->avctx->extradata_size == 1) { + s->avctx->width -= s->avctx->extradata[0] >> 4; + s->avctx->height -= s->avctx->extradata[0] & 0x0F; + } } res = VP56_SIZE_CHANGE; } |