aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-05-30 04:04:54 +0100
committerReinhard Tartler <siretart@tauware.de>2013-01-04 07:43:20 +0100
commita2ae183a382f063c5403922b5151d865ce7252a2 (patch)
treed01d0772883d22e20baea0b5d75a055e9d21b6bc
parent7b91e52eb9fd6012a0804febc7821b9484e6faa6 (diff)
downloadffmpeg-a2ae183a382f063c5403922b5151d865ce7252a2.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> (cherry picked from commit 30f515091c323da59c0f1b533703dedca2f4b95d) Conflicts: libavcodec/h264.c
-rw-r--r--libavcodec/h264.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 90293f17f4..ac7eb20f35 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2605,6 +2605,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
s->height = s->avctx->height;
}
+ 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))) {