]> git.sesse.net Git - ffmpeg/commitdiff
h264: Allow stream and container cropping at the same time
authorVittorio Giovara <vittorio.giovara@gmail.com>
Sun, 8 Mar 2015 04:06:32 +0000 (04:06 +0000)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 30 Jun 2015 13:34:37 +0000 (15:34 +0200)
The container cropping is applied only when difference is within 16
pixels, and the smallest value between the two is chosen.

Bug-Id: 383
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/h264_slice.c

index 16043dcb0ea18b33d8573db1c2f2de6b41e3c518..d287662286d4cb538bcfbdad6b1e225ca24fd246 100644 (file)
@@ -896,13 +896,10 @@ 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 (!crop_present &&
-        FFALIGN(h->avctx->width,  16) == h->width &&
-        FFALIGN(h->avctx->height, 16) == h->height) {
+    if (FFALIGN(h->avctx->width,  16) == FFALIGN(width,  16) &&
+        FFALIGN(h->avctx->height, 16) == FFALIGN(height, 16)) {
         width  = h->avctx->width;
         height = h->avctx->height;
     }