Applications have a way to understand where and odd-size video frame
comes from by checking orig_width and orig_height.

Bug-Id: 383
Signed-off-by: Vittorio Giovara <[email protected]>
---
 libavcodec/h264_slice.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 4888219..ba08d52 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1023,12 +1023,9 @@ 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 &&
+    if (FFALIGN(h->avctx->width,  16) == h->width &&
         FFALIGN(h->avctx->height, 16) == h->height) {
         width  = h->avctx->width;
         height = h->avctx->height;
@@ -1053,6 +1050,8 @@ static int init_dimensions(H264Context *h)
 
     h->avctx->coded_width  = h->width;
     h->avctx->coded_height = h->height;
+    h->avctx->orig_width   = h->width  - (h->sps.crop_right + 
h->sps.crop_left);
+    h->avctx->orig_height  = h->height - (h->sps.crop_top   + 
h->sps.crop_bottom);
     h->avctx->width        = width;
     h->avctx->height       = height;
 
-- 
1.9.3 (Apple Git-50)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to