Quoting Vittorio Giovara (2016-12-19 10:11:29)
> On Sun, Dec 18, 2016 at 9:27 PM, Anton Khirnov <an...@khirnov.net> wrote:
> > ---
> >  doc/APIchanges      |  4 ++++
> >  libavutil/frame.c   |  2 ++
> >  libavutil/frame.h   | 14 ++++++++++++++
> >  libavutil/version.h |  2 +-
> >  4 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 7633c99..ca95308 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -13,6 +13,10 @@ libavutil:     2015-08-28
> >
> >  API changes, most recent first:
> >
> > +2016-xx-xx - xxxxxxx - lavu 55.30.0 - frame.h
> > +  Add AVFrame.crop_left/crop_top fields for attaching cropping information 
> > to
> > +  video frames.
> > +
> >  2016-xx-xx - xxxxxxx - lavc 57.29.0 - avcodec.h
> >    Add AV_PKT_DATA_SPHERICAL packet side data to export AVSphericalMapping
> >    information from containers.
> > diff --git a/libavutil/frame.c b/libavutil/frame.c
> > index 1c14f5f..935c281 100644
> > --- a/libavutil/frame.c
> > +++ b/libavutil/frame.c
> > @@ -390,6 +390,8 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame 
> > *src)
> >      dst->key_frame              = src->key_frame;
> >      dst->pict_type              = src->pict_type;
> >      dst->sample_aspect_ratio    = src->sample_aspect_ratio;
> > +    dst->crop_left              = src->crop_left;
> > +    dst->crop_top               = src->crop_top;
> >      dst->pts                    = src->pts;
> >      dst->repeat_pict            = src->repeat_pict;
> >      dst->interlaced_frame       = src->interlaced_frame;
> > diff --git a/libavutil/frame.h b/libavutil/frame.h
> > index 4052199..744d8d2 100644
> > --- a/libavutil/frame.h
> > +++ b/libavutil/frame.h
> > @@ -25,6 +25,7 @@
> >  #ifndef AVUTIL_FRAME_H
> >  #define AVUTIL_FRAME_H
> >
> > +#include <stddef.h>
> >  #include <stdint.h>
> >
> >  #include "avutil.h"
> > @@ -369,6 +370,19 @@ typedef struct AVFrame {
> >       * AVHWFramesContext describing the frame.
> >       */
> >      AVBufferRef *hw_frames_ctx;
> > +
> > +    /**
> > +     * Video frames only.
> > +     * The number of pixels to discard from the left border of the frame to
> > +     * obtain the part of the frame intended for presentation.
> > +     */
> > +    size_t crop_left;
> > +    /**
> > +     * Video frames only.
> > +     * The number of pixels to discard from the top border of the frame to
> > +     * obtain the part of the frame intended for presentation.
> > +     */
> > +    size_t crop_top;
> >  } AVFrame;
> 
> I have a couple of points about this, in random order:
> 
> 1. I had thought agreement was more towards a side data type rather
> than full types, is there any advantage with this approach?

CertainPeople(tm) claim that this is such an essential information about
the frame that it should live directly in it. I do not have a strong
opinion on the matter, so whatever is least objectionable to most people
is fine with me.

> 2. I would agree about having a full rectangle not two directions
> only. Possibly I would keep naming consistent with coded_width and
> coded_height as fields for uncropped size, and width and height for
> cropped size. Optionally left and top could be marked as offset.

Others seems to prefer that width/height are the pure original coded
values, with a full cropping rectangle.

> 3. What about container cropping? eg mov

The caller's job.

> 4. Does this support unaligned cropping? If not what happens to the
> options about it?

Read the following patches to find out.

> 5. What about Theora?

What about it?

> 6. Regarding 2/4, can you add a "third" way for apply_cropping so that
> it exports uncropped values but automatically adds the crop filter
> (kinda like we do for autorotate) and returns the filtered image at
> the cropped dimensions?

avcodec is unable to add any filters. If you wanted to call lavfi from
lavc, j-b would personally strangle you.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to