aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-05-30 04:04:54 +0100
committerReinhard Tartler <siretart@tauware.de>2012-06-10 09:54:47 +0200
commit4eea330a2afa317940a11d5bf5461ba673ab6b67 (patch)
tree18b984957c7733ef43f9c0fda76f7d05414d6386
parent64eb6892ec839fb11f5b62db38810efb638ba806 (diff)
downloadffmpeg-4eea330a2afa317940a11d5bf5461ba673ab6b67.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 (cherry picked from commit e1608014c50eeb9f4744a53de0794eb6bb1269a2) Signed-off-by: Reinhard Tartler <siretart@tauware.de> (cherry picked from commit b102d5d97daedb717c023ec7bfa43047d97de284) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavcodec/h264.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 06ded4d1f1..02ff83309f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1799,6 +1799,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
else
s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
+ 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))) {