aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-08-25 20:40:19 -0400
committerVittorio Giovara <vittorio.giovara@gmail.com>2014-08-26 13:31:29 -0400
commite87f5e4e5f2e2e36b0b7826d708cda7049877af0 (patch)
treec9e579f4bffe807245980b307c86b55e7853ad4d
parent0a024268261d05ccdcf7e03c85fb78d22037a464 (diff)
downloadffmpeg-e87f5e4e5f2e2e36b0b7826d708cda7049877af0.tar.gz
h264: fully check cropping amount from sps
Even if sps.crop is true, the cropping amount may be zero. Fixes a sample with a valid but broken container cropping.
-rw-r--r--libavcodec/h264_slice.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 83d3426353..69aed1d323 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1028,9 +1028,11 @@ static int init_dimensions(H264Context *h)
{
int width = h->width - (h->sps.crop_right + h->sps.crop_left);
int height = h->height - (h->sps.crop_top + h->sps.crop_bottom);
+ int crop_present = h->sps.crop_left || h->sps.crop_top ||
+ h->sps.crop_right || h->sps.crop_bottom;
/* handle container cropping */
- if (!h->sps.crop &&
+ if (!crop_present &&
FFALIGN(h->avctx->width, 16) == h->width &&
FFALIGN(h->avctx->height, 16) == h->height) {
width = h->avctx->width;