On Fri, Jun 10, 2011 at 12:06 AM, Michael Niedermayer <[email protected]> wrote:
>
> Module: libav
> Branch: master
> Commit: d8999306e516663de2b46aed0c79f7bcc77eb5a1
>
> Author:    Michael Niedermayer <[email protected]>
> Committer: Anton Khirnov <[email protected]>
> Date:      Fri Mar 25 01:13:08 2011 +0100
>
> mpeg12: more advanced ffmpeg mpeg2 aspect guessing code.
>
> Fixes issue1613, 621, 562 simultaneously
>
> Signed-off-by: Michael Niedermayer <[email protected]>
> Signed-off-by: Anton Khirnov <[email protected]>
>
> ---
>
>  libavcodec/mpeg12.c |   18 ++++++++++++++++--
>  1 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
> index 0e1536f..03c95c1 100644
> --- a/libavcodec/mpeg12.c
> +++ b/libavcodec/mpeg12.c
> @@ -1293,9 +1293,17 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
>             avctx->ticks_per_frame=2;
>         //MPEG-2 aspect
>             if(s->aspect_ratio_info > 1){
> -                //we ignore the spec here as reality does not match the 
> spec, see for example
> +                AVRational dar =
> +                    av_mul_q(
> +                        av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
> +                                 (AVRational){s1->pan_scan.width, 
> s1->pan_scan.height}),
> +                        (AVRational){s->width, s->height});
> +
> +                // we ignore the spec here and guess a bit as reality does 
> not match the spec, see for example
>                 // res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg
> -                if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0) 
> || 1){
> +                // issue1613, 621, 562
> +                if((s1->pan_scan.width == 0 ) || (s1->pan_scan.height == 0) 
> ||
> +                   (av_cmp_q(dar,(AVRational){4,3}) && 
> av_cmp_q(dar,(AVRational){16,9}))) {
>                     s->avctx->sample_aspect_ratio=
>                         av_div_q(
>                          ff_mpeg2_aspect[s->aspect_ratio_info],
> @@ -1307,6 +1315,12 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
>                          ff_mpeg2_aspect[s->aspect_ratio_info],
>                          (AVRational){s1->pan_scan.width, s1->pan_scan.height}
>                         );
> +//issue1613 4/3 16/9 -> 16/9
> +//res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3
> +//widescreen-issue562.mpg 4/3 16/9 -> 16/9
> +//                    s->avctx->sample_aspect_ratio= 
> av_mul_q(s->avctx->sample_aspect_ratio, (AVRational){s->width, s->height});
> +//av_log(NULL, AV_LOG_ERROR, "A 
> %d/%d\n",ff_mpeg2_aspect[s->aspect_ratio_info].num, 
> ff_mpeg2_aspect[s->aspect_ratio_info].den);
> +//av_log(NULL, AV_LOG_ERROR, "B %d/%d\n",s->avctx->sample_aspect_ratio.num, 
> s->avctx->sample_aspect_ratio.den);
>                 }
>             }else{
>                 s->avctx->sample_aspect_ratio=
>

I'd really appreciate that reviews be done on the ML and not on IRC.

Anyway this is a huge mess. I'd appreciate those responsible to clean it up.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to