diff options
author | Mans Rullgard <mans@mansr.com> | 2012-05-30 04:04:54 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-06-09 15:08:52 +0100 |
commit | 30f515091c323da59c0f1b533703dedca2f4b95d (patch) | |
tree | e6669b55340d603bc5e05f3a4786c0533c9203dc /libavcodec | |
parent | 8aa93e900449c88c3169ff5636fed03f41779cac (diff) | |
download | ffmpeg-30f515091c323da59c0f1b533703dedca2f4b95d.tar.gz |
h264: allow cropping to AVCodecContext.width/height
Override the frame size from the SPS with AVCodecContext values
if the latter specify a size smaller by less than one macroblock.
This is required for correct cropping of MOV files from Canon cameras.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 6ed251ecf2..025a0dd156 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2968,6 +2968,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0) else s->height = 16 * s->mb_height - (2 << s->chroma_y_shift) * FFMIN(h->sps.crop_bottom, (16 >> s->chroma_y_shift) - 1); + if (FFALIGN(s->avctx->width, 16) == s->width && + FFALIGN(s->avctx->height, 16) == s->height) { + s->width = s->avctx->width; + s->height = s->avctx->height; + } + if (s->context_initialized && (s->width != s->avctx->width || s->height != s->avctx->height || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) { |