On 23/10/15 15:24, Vittorio Giovara wrote:
> From: Thomas Mundt <[email protected]>
> 
> Default field order to top field first when interlaced frame is
> detected and pic_struct_present_flag is not set.
> Since bottom field first comes from the old NTSC standard and it is not
> used with HD anymore I think it´s straight forward to favor the majority.

I'm not sure at all, I'd either not do that or I'd rather spend few more
cycles and check if the content has the resolution and frame-rate (if
available) matching NTSC.

It is an heuristic but better that than breaking existing files for no
reason IMHO.

> Signed-off-by: Thomas Mundt <[email protected]>
> Signed-off-by: Michael Niedermayer <[email protected]>
> Signed-off-by: Vittorio Giovara <[email protected]>
> ---
>  libavcodec/h264.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index ec57d6d..c35bb9a 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -758,7 +758,7 @@ static void decode_postinit(H264Context *h, int 
> setup_finished)
>          /* Derive top_field_first from field pocs. */
>          cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
>      } else {
> -        if (cur->f->interlaced_frame || h->sps.pic_struct_present_flag) {
> +        if (h->sps.pic_struct_present_flag) {
>              /* Use picture timing SEI information. Even if it is a
>               * information of a past frame, better than nothing. */
>              if (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM ||
> @@ -766,6 +766,10 @@ static void decode_postinit(H264Context *h, int 
> setup_finished)
>                  cur->f->top_field_first = 1;
>              else
>                  cur->f->top_field_first = 0;
> +        } else if (cur->f->interlaced_frame) {
> +            /* Default to top field first when pic_struct_present_flag
> +             * is not set but interlaced frame detected */
> +            cur->f->top_field_first = 1;
>          } else {
>              /* Most likely progressive */
>              cur->f->top_field_first = 0;
> 

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

Reply via email to