Commit 6eec2a06 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

transform: add transposition and anti-transposition transforms

parent 39ddd4de
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2006 the VideoLAN team * Copyright (C) 2000-2006 the VideoLAN team
* Copyright (C) 2010 Laurent Aimar * Copyright (C) 2010 Laurent Aimar
* $Id$ * Copyright (C) 2012 Rémi Denis-Courmont
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Laurent Aimar <fenrir _AT_ videolan _DOT_ org> * Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
...@@ -45,10 +45,12 @@ static void Close(vlc_object_t *); ...@@ -45,10 +45,12 @@ static void Close(vlc_object_t *);
#define CFG_PREFIX "transform-" #define CFG_PREFIX "transform-"
#define TYPE_TEXT N_("Transform type") #define TYPE_TEXT N_("Transform type")
static const char * const type_list[] = { "90", "180", "270", "hflip", "vflip" }; static const char * const type_list[] = { "90", "180", "270",
"hflip", "vflip", "transpose", "antitranspose" };
static const char * const type_list_text[] = { N_("Rotate by 90 degrees"), static const char * const type_list_text[] = { N_("Rotate by 90 degrees"),
N_("Rotate by 180 degrees"), N_("Rotate by 270 degrees"), N_("Rotate by 180 degrees"), N_("Rotate by 270 degrees"),
N_("Flip horizontally"), N_("Flip vertically") }; N_("Flip horizontally"), N_("Flip vertically"),
N_("Transpose"), N_("Anti-transpose") };
vlc_module_begin() vlc_module_begin()
set_description(N_("Video transformation filter")) set_description(N_("Video transformation filter"))
...@@ -80,6 +82,17 @@ static void VFlip(int *sx, int *sy, int w, int h, int dx, int dy) ...@@ -80,6 +82,17 @@ static void VFlip(int *sx, int *sy, int w, int h, int dx, int dy)
*sx = dx; *sx = dx;
*sy = h - 1 - dy; *sy = h - 1 - dy;
} }
static void Transpose(int *sx, int *sy, int w, int h, int dx, int dy)
{
VLC_UNUSED( h ); VLC_UNUSED( w );
*sx = dy;
*sy = dx;
}
static void AntiTranspose(int *sx, int *sy, int w, int h, int dx, int dy)
{
*sx = h - 1 - dy;
*sy = w - 1 - dx;
}
static void R90(int *sx, int *sy, int w, int h, int dx, int dy) static void R90(int *sx, int *sy, int w, int h, int dx, int dy)
{ {
VLC_UNUSED( h ); VLC_UNUSED( h );
...@@ -150,12 +163,14 @@ static void Plane32_##f(plane_t *restrict dst, const plane_t *restrict src) \ ...@@ -150,12 +163,14 @@ static void Plane32_##f(plane_t *restrict dst, const plane_t *restrict src) \
PLANAR(HFlip) PLANAR(HFlip)
PLANAR(VFlip) PLANAR(VFlip)
PLANAR(Transpose)
PLANAR(AntiTranspose)
PLANAR(R90) PLANAR(R90)
PLANAR(R180) PLANAR(R180)
PLANAR(R270) PLANAR(R270)
typedef struct { typedef struct {
char name[8]; char name[16];
bool is_rotated; bool is_rotated;
convert_t convert; convert_t convert;
convert_t iconvert; convert_t iconvert;
...@@ -168,11 +183,13 @@ typedef struct { ...@@ -168,11 +183,13 @@ typedef struct {
{ str, rotated, f, invf, Plane8_##f, Plane16_##f, Plane32_##f } { str, rotated, f, invf, Plane8_##f, Plane16_##f, Plane32_##f }
static const transform_description_t descriptions[] = { static const transform_description_t descriptions[] = {
DESC("90", true, R90, R270), DESC("90", true, R90, R270),
DESC("180", false, R180, R180), DESC("180", false, R180, R180),
DESC("270", true, R270, R90), DESC("270", true, R270, R90),
DESC("hflip", false, HFlip, HFlip), DESC("hflip", false, HFlip, HFlip),
DESC("vflip", false, VFlip, VFlip), DESC("vflip", false, VFlip, VFlip),
DESC("transpose", true, Transpose, Transpose),
DESC("antitranspose", true, AntiTranspose, AntiTranspose),
}; };
static const size_t n_transforms = static const size_t n_transforms =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment