History

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.

Mans Rullgard committed 14 years ago

Commit 30f51501 parent 8aa93e91 file · +6 −0Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/h264.c+6−0
@@ -2968,6 +2968,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0) · 2967 unmodified lines
29682968 else
29692969 s->height = 16 * s->mb_height - (2 << s->chroma_y_shift) * FFMIN(h->sps.crop_bottom, (16 >> s->chroma_y_shift) - 1);
29702970
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+
29712977 if (s->context_initialized &&
29722978 (s->width != s->avctx->width || s->height != s->avctx->height ||
29732979 av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t