[FFmpeg-devel] [PATCH v3] H.264: reinitialize context on aspect ratio change as well

Janusz Krzysztofik jkrzyszt
Mon Mar 15 15:08:52 CET 2010


Hi,
Have you already found some spare time to review this new, corrected version?
Am I supposed to do anything about it?

Thanks,
Janusz

---------------------
Thursday 04 March 2010 00:26:24 Janusz Krzysztofik wrote:
> While using ffmpeg based vdr softdevice plugin for watching h.264 encoded
> live tv, I found that after correct picture aspect ratio setup on a new
> stream startup, any following picture aspect ratio changes were not
> processed. The same applies to playing vdr caputured samples of this
> transmission with ffplay.
>
> This patch corrects the problem for me by reinitializing the decoder
> context on every valid aspect ratio change, not only size changes.
>
> Created against ffmpeg svn revision 22110 dated 2010-02-28.
> Tested using this revision ffplay on x86_64.
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt at tis.icnet.pl>
>
> ---
> Hi,
>
> I'v noticed that there were problems with the previous version of this
> patch and it has been reverted.
>
> This version should correct this problem, I've tested it successfully with
> every sample from http://samples.ffmpeg.org/V-codecs/h264/ that also played
> for me without the patch.
>
> Thanks,
> Janusz
>
>
> --- trunk/libavcodec/h264.c.orig	2010-03-03 22:57:53.000000000 +0100
> +++ trunk/libavcodec/h264.c	2010-03-03 23:20:44.000000000 +0100
> @@ -1774,7 +1774,11 @@ static int decode_slice_header(H264Conte
>          s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
>
>      if (s->context_initialized
> -        && (   s->width != s->avctx->width || s->height != s->avctx->height)) {
> +        && (   s->width != s->avctx->width || s->height != s->avctx->height
> >            || (h->sps.sar.num  
> +                && h->sps.sar.num != s->avctx->sample_aspect_ratio.num)
> +            || (h->sps.sar.den
> +                && h->sps.sar.den != s->avctx->sample_aspect_ratio.den))) {
>          if(h != h0) 
>              return -1;   // width / height changed during parallelized decoding
>          free_tables(h); 





More information about the ffmpeg-devel mailing list