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

Michael Niedermayer michael at niedermayer.cc
Wed Apr 4 23:35:37 EEST 2018


On Wed, Apr 04, 2018 at 05:30:24PM +0200, Vittorio Giovara wrote:
> The transformation operations that can be described by a display matrix
> are not limited to pure rotation, but include horizontal and vertical
> flip, as well as transpose and antitranspose. Unfortunately the current
> API can only return a rotation angle in degrees, and is not designed to
> detect flip operations or a combination of rotation and flip.
> 
> So implement an additional API to analyze the display matrix and return
> the most common rotation operations (multiples of 90ยบ) as well flips or
> a combination thereof. This function returns a bitfield mask composed of
> AVDisplayOrientation elements that describe which rendering operations
> should be performed on the frame. The existing API is still available
> and useful in case of custom rotations.
> 
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> ---
> Note: the new operations describe a clockwise rotation, while the
> old API provided a counterclockwise rotation. I always felt this was
> a mistake as it's counterintuitive and suprising to new users, so I
> didn't want to cargo-cult it to a new API. What do people think about it?
> 
> See also https://github.com/FFMS/ffms2/issues/317 for flipped samples, code,
> and additional discussion.
> 
> Missing changelog entry and version bump.
> Vittorio
> 
>  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

(there are more parameters like translation and z specific changes but IIUC
 these have no meaning ?)
 
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

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- 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/20180404/01ec8ffc/attachment.sig>


More information about the ffmpeg-devel mailing list