[FFmpeg-cvslog] h264: Allow stream and container cropping at the same time

Vittorio Giovara git at videolan.org
Tue Jun 30 21:19:22 CEST 2015


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Sun Mar  8 04:06:32 2015 +0000| [3e3056f2a020dd77efdf379dbd4c06a65b4a499a] | committer: Vittorio Giovara

h264: Allow stream and container cropping at the same time

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e3056f2a020dd77efdf379dbd4c06a65b4a499a
---

 libavcodec/h264_slice.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 16043dc..d287662 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -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;
     }



More information about the ffmpeg-cvslog mailing list