[FFmpeg-devel] [PATCH v1] fftools/ffmpeg: Add support for per frame rotation and flip
Michael Niedermayer
michael at niedermayer.cc
Mon May 13 12:58:46 EEST 2019
On Sat, May 11, 2019 at 10:57:01PM -0700, Jun Li wrote:
> On Sat, May 11, 2019 at 10:47 PM Jun Li <junli1026 at gmail.com> wrote:
>
> > Fix #6945
> > Current implementaion for autorotate works fine for stream
> > level rotataion but no support for frame level operation
> > and frame flip. This patch is for adding flip support and
> > per frame operations.
> > ---
> > fftools/cmdutils.c | 9 ++---
> > fftools/cmdutils.h | 2 +-
> > fftools/ffmpeg.c | 21 +++++++++-
> > fftools/ffmpeg.h | 2 +
> > fftools/ffmpeg_filter.c | 81 ++++++++++++++++++++++++++++++++++++---
> > fftools/ffplay.c | 28 +++++++++++---
> > libavutil/display.c | 14 +++++++
> > libavutil/display.h | 14 +++++++
> > libavutil/tests/display.c | 8 ++++
> > tests/ref/fate/display | 4 ++
> > 10 files changed, 166 insertions(+), 17 deletions(-)
[...]
> > \ No newline at end of file
> > diff --git a/libavutil/display.h b/libavutil/display.h
> > index 515adad795..23d71a0bc5 100644
> > --- a/libavutil/display.h
> > +++ b/libavutil/display.h
> > @@ -106,6 +106,20 @@ void av_display_rotation_set(int32_t matrix[9],
> > double angle);
> > */
> > void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);
> >
> > +/**
> > + * Extract the rotation component and hflip status of the transformation
> > matrix.
> > + *
> > + * @param matrix the transformation matrix
> > + * @param hflip wille be set to 1 if the matrix need horizontal flipped
> > + * @return the angle (in degrees) by which the transformation rotates the
> > frame
> > + * counterclockwise. The angle will be in range [-180.0, 180.0],
> > + * or NaN if the matrix is singular.
> > + *
> > + * @note floating point numbers are inherently inexact, so callers are
> > + * recommended to round the return value to nearest integer before
> > use.
> > + */
> > +double av_display_rotation_hflip_get(const int32_t matrix[9], int* hflip);
> > +
> > /**
> > * @}
> > * @}
> > diff --git a/libavutil/tests/display.c b/libavutil/tests/display.c
> > index 893ebb5543..65a0971e7b 100644
> > --- a/libavutil/tests/display.c
> > +++ b/libavutil/tests/display.c
> > @@ -35,6 +35,8 @@ static void print_matrix(int32_t matrix[9])
> > int main(void)
> > {
> > int32_t matrix[9];
> > + int hflip = 0;
> > + double degree;
> >
> > // Set the matrix to 90 degrees
> > av_display_rotation_set(matrix, 90);
> > @@ -56,6 +58,12 @@ int main(void)
> > print_matrix(matrix);
> > printf("degrees: %f\n", av_display_rotation_get(matrix));
> >
> > + // flip vertical
> > + av_display_matrix_flip(matrix, 0, 1);
> > + print_matrix(matrix);
> > + degree = av_display_rotation_hflip_get(matrix, &hflip);
> > + printf("degrees: %f, hflip: %i\n", degree, hflip);
> > +
> > return 0;
> >
> > }
[...]
> This change is to address the feedback of last patch using 1st frame's
> orientation as stream rotation.
> Thanks again for review. I added the support for per frame rotation.
>
> (I know it involves too many file changes and not easy to read. Sorry about
> that I tried to
> separate them but failed since due to some dependencies).
The libavutil changes should be in a seperate patch and need a version
and APIChanges update
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190513/684bca98/attachment.sig>
More information about the ffmpeg-devel
mailing list