Path: blob/master/dep/ffmpeg/include/libavutil/display.h
4216 views
/*1* Copyright (c) 2014 Vittorio Giovara <[email protected]>2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920/**21* @file22* @ingroup lavu_video_display23* Display matrix24*/2526#ifndef AVUTIL_DISPLAY_H27#define AVUTIL_DISPLAY_H2829#include <stdint.h>3031/**32* @defgroup lavu_video_display Display transformation matrix functions33* @ingroup lavu_video34*35* The display transformation matrix specifies an affine transformation that36* should be applied to video frames for correct presentation. It is compatible37* with the matrices stored in the ISO/IEC 14496-12 container format.38*39* The data is a 3x3 matrix represented as a 9-element array:40*41* @code{.unparsed}42* | a b u |43* (a, b, u, c, d, v, x, y, w) -> | c d v |44* | x y w |45* @endcode46*47* All numbers are stored in native endianness, as 16.16 fixed-point values,48* except for u, v and w, which are stored as 2.30 fixed-point values.49*50* The transformation maps a point (p, q) in the source (pre-transformation)51* frame to the point (p', q') in the destination (post-transformation) frame as52* follows:53*54* @code{.unparsed}55* | a b u |56* (p, q, 1) . | c d v | = z * (p', q', 1)57* | x y w |58* @endcode59*60* The transformation can also be more explicitly written in components as61* follows:62*63* @code{.unparsed}64* p' = (a * p + c * q + x) / z;65* q' = (b * p + d * q + y) / z;66* z = u * p + v * q + w67* @endcode68*69* @{70*/7172/**73* Extract the rotation component of the transformation matrix.74*75* @param matrix the transformation matrix76* @return the angle (in degrees) by which the transformation rotates the frame77* counterclockwise. The angle will be in range [-180.0, 180.0],78* or NaN if the matrix is singular.79*80* @note floating point numbers are inherently inexact, so callers are81* recommended to round the return value to nearest integer before use.82*/83double av_display_rotation_get(const int32_t matrix[9]);8485/**86* Initialize a transformation matrix describing a pure clockwise87* rotation by the specified angle (in degrees).88*89* @param[out] matrix a transformation matrix (will be fully overwritten90* by this function)91* @param angle rotation angle in degrees.92*/93void av_display_rotation_set(int32_t matrix[9], double angle);9495/**96* Flip the input matrix horizontally and/or vertically.97*98* @param[in,out] matrix a transformation matrix99* @param hflip whether the matrix should be flipped horizontally100* @param vflip whether the matrix should be flipped vertically101*/102void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);103104/**105* @}106*/107108#endif /* AVUTIL_DISPLAY_H */109110111