[FFmpeg-cvslog] r25669 - in trunk/libavcodec: h264.c h264_ps.c mpegvideo.c utils.c

reimar subversion
Wed Nov 3 21:52:28 CET 2010


Author: reimar
Date: Wed Nov  3 21:52:28 2010
New Revision: 25669

Log:
H.264 decode: support cropping up to 28 pixels in interlaced mode.
Contrary to progressive, just being able to crop up to 14/15 pixels
is not enough to encode all supported resolutions, and the new
behaviour is also consistent with e.g. MPEG-2 etc.

Modified:
   trunk/libavcodec/h264.c
   trunk/libavcodec/h264_ps.c
   trunk/libavcodec/mpegvideo.c
   trunk/libavcodec/utils.c

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	Wed Nov  3 21:19:34 2010	(r25668)
+++ trunk/libavcodec/h264.c	Wed Nov  3 21:52:28 2010	(r25669)
@@ -1810,7 +1810,7 @@ static int decode_slice_header(H264Conte
     if(h->sps.frame_mbs_only_flag)
         s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7);
     else
-        s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
+        s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 7);
 
     if (s->context_initialized
         && (   s->width != s->avctx->width || s->height != s->avctx->height

Modified: trunk/libavcodec/h264_ps.c
==============================================================================
--- trunk/libavcodec/h264_ps.c	Wed Nov  3 21:19:34 2010	(r25668)
+++ trunk/libavcodec/h264_ps.c	Wed Nov  3 21:52:28 2010	(r25669)
@@ -373,7 +373,7 @@ int ff_h264_decode_seq_parameter_set(H26
         if(sps->crop_left || sps->crop_top){
             av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
         }
-        if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){
+        if(sps->crop_right >= 8 || sps->crop_bottom >= 8){
             av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
         }
     }else{

Modified: trunk/libavcodec/mpegvideo.c
==============================================================================
--- trunk/libavcodec/mpegvideo.c	Wed Nov  3 21:19:34 2010	(r25668)
+++ trunk/libavcodec/mpegvideo.c	Wed Nov  3 21:52:28 2010	(r25669)
@@ -498,7 +498,7 @@ av_cold int MPV_common_init(MpegEncConte
 
     if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
         s->mb_height = (s->height + 31) / 32 * 2;
-    else
+    else if (s->codec_id != CODEC_ID_H264)
         s->mb_height = (s->height + 15) / 16;
 
     if(s->avctx->pix_fmt == PIX_FMT_NONE){

Modified: trunk/libavcodec/utils.c
==============================================================================
--- trunk/libavcodec/utils.c	Wed Nov  3 21:19:34 2010	(r25668)
+++ trunk/libavcodec/utils.c	Wed Nov  3 21:52:28 2010	(r25669)
@@ -140,7 +140,7 @@ void avcodec_align_dimensions2(AVCodecCo
     case PIX_FMT_YUVA420P:
         w_align= 16; //FIXME check for non mpeg style codecs and use less alignment
         h_align= 16;
-        if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP)
+        if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP || s->codec_id == CODEC_ID_H264)
             h_align= 32; // interlaced is rounded up to 2 MBs
         break;
     case PIX_FMT_YUV411P:



More information about the ffmpeg-cvslog mailing list