[FFmpeg-devel] [PATCH] display: Add AVDisplayOrientation API

Vittorio Giovara vittorio.giovara at gmail.com
Thu Apr 5 14:51:10 EEST 2018


---
> On Wed, Apr 04, 2018 at 05:30:24PM +0200, Vittorio Giovara wrote:
> >  libavutil/display.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  libavutil/display.h | 53 ++++++++++++++++++++++++++++++
> >  2 files changed, 145 insertions(+)

>     It might be more usefull to fully factorize the matrix than these special cases
> 
>     for example the matrix can be described by these 4 scalars
>     1. rotation
>     2. horizontal scale
>     3. vertical scale
>     4. shear

With the proposed API the matrix is already factorized: a mask is returned
containing a set of  operation. Special cases such as custom rotation is
already factorized, as in you need to call an additional function on the
same matrix to know more about the rotation angle. On the other hand the
most common cases are already ready to be used right away.

Do you think it should just expose the fact that it is a rotation and always
require the user to inspect the matrix again? Note that hflip and vflip can't
be described with pure rotation angles. I feel like this would complicate
the API.

For any missing operation, such as transpose, shear, and scaling, this API
should be extensible enoughe, so that if anybody wants to add enum values
and functions to retrieve the desired operation, it can be done.

>     (there are more parameters like translation and z specific changes but IIUC
>       these have no meaning ?)

Correct given that video right now is a 2d surface we can ignore anything
related to the depth axis.

>     Note fliping in above would be a negative scale value
>     shear could be specified as the angle between the x/y basis vectors
> 
>     The reason i suggest this is that these 4 values are easier to understand
>     for a human and should allow reconstructing an equivalent transform matrix.
>     While at the same time not limiting things to a subset of special cases
> 

The "special cases" are also the most common operations that every player
implements so I think it makes sense to have them readily available, with
as few calls as possible.

>     -- 
>     Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

(I'm trying something different wrt my mail client, I hope it doesn't botch
 the threaded reply again).
-- 
Vittorio


More information about the ffmpeg-devel mailing list