diff mbox

[FFmpeg-devel] avcodec/hevc_sei: Support HEVC paired fields.

Message ID 1505439559-14948-1-git-send-email-brian.matherly@yahoo.com
State Superseded
Headers show

Commit Message

Brian Matherly Sept. 15, 2017, 1:39 a.m. UTC
Correctly set frame.interlaced and frame.top_field_first when pic_struct
indicates paired fields.
---
 libavcodec/hevc_sei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Brian Matherly Sept. 21, 2017, 9:57 p.m. UTC | #1
On 9/14/2017 8:39 PM, Brian Matherly wrote:
> Correctly set frame.interlaced and frame.top_field_first when pic_struct
> indicates paired fields.
> ---
>   libavcodec/hevc_sei.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> index cd55d50..d0f9966 100644
> --- a/libavcodec/hevc_sei.c
> +++ b/libavcodec/hevc_sei.c
> @@ -137,10 +137,10 @@ static int decode_nal_sei_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const
>       if (sps->vui.frame_field_info_present_flag) {
>           int pic_struct = get_bits(gb, 4);
>           h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
> -        if (pic_struct == 2) {
> +        if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
>               av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
>               h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
> -        } else if (pic_struct == 1) {
> +        } else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
>               av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
>               h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
>           }

Ping.

I think this should be an obvious change. If you look at table D.2 in 
Rec. ITU-T H.265, these four values are for fields.

~Brian

.
Michael Niedermayer Sept. 23, 2017, 10:22 p.m. UTC | #2
On Thu, Sep 14, 2017 at 08:39:19PM -0500, Brian Matherly wrote:
> Correctly set frame.interlaced and frame.top_field_first when pic_struct
> indicates paired fields.

Do you have a (small) sample that gets fixed by this ?

Can you make a fate test for this case ?

[...]
Brian Matherly Sept. 24, 2017, 7:42 p.m. UTC | #3
On 9/23/2017 5:22 PM, Michael Niedermayer wrote:
> On Thu, Sep 14, 2017 at 08:39:19PM -0500, Brian Matherly wrote:
>> Correctly set frame.interlaced and frame.top_field_first when pic_struct
>> indicates paired fields.
> Do you have a (small) sample that gets fixed by this ?
>
> Can you make a fate test for this case ?
>
> [...]
>

Thanks Michael,

I submitted a V2 patch (sorry about the double e-mail). V2 includes a 
fate test which uses probeframes. The reason I test probeframes is 
because the pixel data in the frame is exactly the same with/wo the 
patch - and the important part of the test is the value of the 
interlaced_frame and repeat_first_field fields.

The sample file is uploaded to the videolan uploader: paired_fields.hevc
It should be placed in: fate-suite/hevc/paired_fields.hevc

Thanks,

~Brian
Michael Niedermayer Sept. 28, 2017, 9:35 p.m. UTC | #4
On Sun, Sep 24, 2017 at 02:42:20PM -0500, Brian Matherly wrote:
> On 9/23/2017 5:22 PM, Michael Niedermayer wrote:
> >On Thu, Sep 14, 2017 at 08:39:19PM -0500, Brian Matherly wrote:
> >>Correctly set frame.interlaced and frame.top_field_first when pic_struct
> >>indicates paired fields.
> >Do you have a (small) sample that gets fixed by this ?
> >
> >Can you make a fate test for this case ?
> >
> >[...]
> >
> 
> Thanks Michael,
> 
> I submitted a V2 patch (sorry about the double e-mail). V2 includes
> a fate test which uses probeframes. The reason I test probeframes is
> because the pixel data in the frame is exactly the same with/wo the
> patch - and the important part of the test is the value of the
> interlaced_frame and repeat_first_field fields.
> 
> The sample file is uploaded to the videolan uploader: paired_fields.hevc

> It should be placed in: fate-suite/hevc/paired_fields.hevc

uploaded


[...]
diff mbox

Patch

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index cd55d50..d0f9966 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -137,10 +137,10 @@  static int decode_nal_sei_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const
     if (sps->vui.frame_field_info_present_flag) {
         int pic_struct = get_bits(gb, 4);
         h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
-        if (pic_struct == 2) {
+        if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
             av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
             h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
-        } else if (pic_struct == 1) {
+        } else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
             av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
             h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
         }