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.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -2968,6 +2968,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0) · 2967 unmodified lines | ||
| 2968 | 2968 | else |
| 2969 | 2969 | s->height = 16 * s->mb_height - (2 << s->chroma_y_shift) * FFMIN(h->sps.crop_bottom, (16 >> s->chroma_y_shift) - 1); |
| 2970 | 2970 | |
| 2971 | + if (FFALIGN(s->avctx->width, 16) == s->width && | |
| 2972 | + FFALIGN(s->avctx->height, 16) == s->height) { | |
| 2973 | + s->width = s->avctx->width; | |
| 2974 | + s->height = s->avctx->height; | |
| 2975 | + } | |
| 2976 | + | |
| 2971 | 2977 | if (s->context_initialized && |
| 2972 | 2978 | (s->width != s->avctx->width || s->height != s->avctx->height || |
| 2973 | 2979 | av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) { |