[vlc-devel] [PATCH 2/9] Add transform helper functions.

Rémi Denis-Courmont remi at remlab.net
Wed Mar 5 18:53:35 CET 2014


Le mercredi 5 mars 2014, 18:49:17 Matthias Keiser a écrit :
> Am 05.03.2014 um 18:12 schrieb Rémi Denis-Courmont <remi at remlab.net>:
> > Le mercredi 5 mars 2014, 17:01:23 Matthias Keiser a écrit :
> >> ---
> >> include/vlc_es.h     |  48 +++++++++++++
> >> src/misc/es_format.c | 196
> >> +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 244
> >> insertions(+)
> >> 
> >> diff --git a/include/vlc_es.h b/include/vlc_es.h
> >> index 38d63da..d7e43e7 100644
> >> --- a/include/vlc_es.h
> >> +++ b/include/vlc_es.h
> >> @@ -153,6 +153,8 @@ typedef enum video_orientation_t
> >> 
> >>     ORIENT_RIGHT_BOTTOM, /**< Anti-transposed */
> >>     
> >>     ORIENT_NORMAL      = ORIENT_TOP_LEFT,
> >> 
> >> +    ORIENT_TRANSPOSED  = ORIENT_LEFT_TOP,
> >> +    ORIENT_ANTI_TRANSPOSED = ORIENT_RIGHT_BOTTOM,
> >> 
> >>     ORIENT_HFLIPPED    = ORIENT_TOP_RIGHT,
> >>     ORIENT_VFLIPPED    = ORIENT_BOTTOM_LEFT,
> >>     ORIENT_ROTATED_180 = ORIENT_BOTTOM_RIGHT,
> >> 
> >> @@ -174,6 +176,18 @@ typedef enum video_orientation_t
> >> /** Applies horizontal flip to an orientation */
> >> #define ORIENT_ROTATE_180(orient) ((orient) ^ 3)
> >> 
> >> +typedef enum video_transform_t
> >> +{
> >> +    TRANSFORM_IDENTIY = 0,
> >> +    TRANSFORM_HFLIP,
> >> +    TRANSFORM_VFLIP,
> >> +    TRANSFORM_R90,
> >> +    TRANSFORM_R180,
> >> +    TRANSFORM_R270,
> >> +    TRANSFORM_TRANSPOSE,
> >> +    TRANSFORM_ANTI_TRANSPOSE
> >> +} video_transform_t;
> >> +
> > 
> > I don't understand why you need a second identical enumeration.
> 
> Because it makes sense semantically.

This is debatable. Mathematically speaking, an orientation is a transform and 
vice-versa.

> It has to do with that we now handle
> transform from/to arbitrary orientations, as you requested. Conceived
> example: transforming from ORIENT_VFLIPPED to ORIENT_TRANSPOSED needs a
> TRANSFORM_R90, it wouldn't make sense to call this ORIENT_ROTATED_90 there.

If the "ed" grammar suffixes hurt you, feel free to remove them.

> Basically ORIENT_Z = ORIENT_X * TRANSFORM_Y.

At the very least you should force equal values so that the enum can be 
casted/converted directly. That would save a lot of boilerplate.


-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list