[FFmpeg-devel] [PATCH] lavc: report frame field order in avctx

Michael Niedermayer michael at niedermayer.cc
Fri Nov 18 02:47:00 EET 2016


On Thu, Nov 17, 2016 at 04:48:07AM -0600, Rodger Combs wrote:
> 
> > On Nov 15, 2016, at 03:43, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > 
> > On Mon, Nov 14, 2016 at 05:19:25PM -0600, Rodger Combs wrote:
> >> ---
> >> libavcodec/utils.c                   | 13 +++++++++++++
> >> tests/api/api-codec-param-test.c     |  3 +++
> >> tests/fate/matroska.mak              |  2 +-
> >> tests/ref/fate/api-mjpeg-codec-param |  2 +-
> >> tests/ref/fate/api-png-codec-param   |  2 +-
> >> tests/ref/fate/mov-zombie            |  2 +-
> >> 6 files changed, 20 insertions(+), 4 deletions(-)
> >> 
> >> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> >> index d6dca18..b9af880 100644
> >> --- a/libavcodec/utils.c
> >> +++ b/libavcodec/utils.c
> >> @@ -2296,6 +2296,12 @@ fail:
> >>                                                guess_correct_pts(avctx,
> >>                                                                  picture->pts,
> >>                                                                  picture->pkt_dts));
> >> +
> >> +            if (avctx->field_order == AV_FIELD_UNKNOWN) {
> >> +                avctx->field_order = picture->interlaced_frame
> >> +                                   ? (picture->top_field_first ? AV_FIELD_TT : AV_FIELD_BB)
> >> +                                   : AV_FIELD_PROGRESSIVE;
> >> +            }
> >>         } else
> >>             av_frame_unref(picture);
> >>     } else
> >> @@ -2895,6 +2901,13 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
> >>                 av_frame_set_best_effort_timestamp(frame,
> >>                     guess_correct_pts(avctx, frame->pts, frame->pkt_dts));
> >>             }
> >> +
> >> +            if (avctx->field_order == AV_FIELD_UNKNOWN &&
> >> +                avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
> >> +                avctx->field_order = frame->interlaced_frame
> >> +                                   ? (frame->top_field_first ? AV_FIELD_TT : AV_FIELD_BB)
> >> +                                   : AV_FIELD_PROGRESSIVE;
> >> +            }
> >>         }
> >>         return ret;
> >>     }
> > 
> > This doesnt leave any "unknown" option left.
> > What should a decoder do that knows the field order is unknown
> 
> Is this a real case?

any codec that doesnt have a interlaced flag couldnt set this
rawvideo and various lossless codecs can store interlaced material
without problems but lack such flags.


> 
> What I really need here is a stream-level "is interlaced" indicator; I've considered adding an AV_FIELD_INTERLACED_UNKNOWN value to indicate "This is interlaced, but I don't know the field order".
> Thoughts?

I think AVFrame lacks a unknown between progressive and interlaced

If you want a video filter to fill in only unknown ones that distinction
would be important


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161118/44a2d609/attachment.sig>


More information about the ffmpeg-devel mailing list